gorynich 1.3.2.231715 → 1.3.4.273062

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 934c609dc4ca0e3ebff06eacd58dde28bef02381862cafaed2c75836ccdc00b8
4
- data.tar.gz: 563a7047f3c58c139bd3b18f9826fb2fe5a7c54ab27b2f3f2a034c7cfca2438b
3
+ metadata.gz: c86ef9f339490757d3eae9bd623ab475f98f41a0811c591d48e7c265a9f69677
4
+ data.tar.gz: 10b7d0dd91f8bbc0ffb8e68ceced64f49deaf1786eadb32dea07f1e61baa78de
5
5
  SHA512:
6
- metadata.gz: 4fd586dc2bfea2e076cb11c04e9a4e8f97897c2ce50bdb0f7dbfc20f6059f8c10d100dd5c8e82edaa1586f19692a3050349a937c70086a64d823cb1fa0e6e475
7
- data.tar.gz: 0bc93c0a785765a98e8abfd0d1679c80565e6e34aeb7f7ba07c8a41928e3d75385570eb4b7b74594cc03d8ceeae55a523ddde4cfc4fbe2e96bc921c0300f0688
6
+ metadata.gz: b26ed7637cbe6d0326f3f0a97cefc008897b30a8e43aa308cf7ee52ee3a0204fa1409e5b1225a0f99f0e049e0c5c453ada7a9ddf74ef118c31904b10bd56e4d9
7
+ data.tar.gz: bd37c26bc90f3ecd5e8554465c38d7176d383142fffacfba6b2b6ca13381946f840d27ca1b840e0d052f75af3229e3a5bda02061110ae8ebf95b4fb1b6efdcd8
@@ -126,13 +126,17 @@ module Gorynich
126
126
 
127
127
  #
128
128
  # Database config for database.yml
129
+ # If used <%= Gorynich.instance.database_config(your_enviroment) %> without gorynich config it will raise an error.
130
+ # You can use <%= Gorynich.instance.database_config(your_enviroment, fail_ignore: true) %> if there is no configuration for the environment
131
+ # and dummy_value depending on whether you have a configuration in the database.yml under this environment (dummy_value: nil when there is and dummy_value: {} if there is not. Default dummy_value is nil)
129
132
  #
130
133
  # @param [String] env enviroment
131
- # @param [Boolean] with_ignore ignore if there is no configuration for the environment
134
+ # @param [Boolean] fail_ignore ignore if there is no configuration for the environment
135
+ # @param [nil or Hash] dummy_value value for YAML if there is no config.
132
136
  #
133
137
  # @return [String] yaml result
134
138
  #
135
- def database_config(env = nil, fail_ignore: false)
139
+ def database_config(env = nil, fail_ignore: false, dummy_value: nil)
136
140
  envs = Dir.glob(Rails.root.join('config/environments/*.rb').to_s).map { |f| File.basename(f, '.rb') }
137
141
  cfg = fetcher.fetch.extract!(*envs)
138
142
 
@@ -146,7 +150,7 @@ module Gorynich
146
150
  end
147
151
  else
148
152
  if fail_ignore && cfg[env].nil?
149
- { env => {} }
153
+ { env => dummy_value }
150
154
  else
151
155
  {
152
156
  env => configs_sort(cfg.fetch(env)).to_h { |t, c| [t, c.fetch('db_config')] }
@@ -154,7 +158,7 @@ module Gorynich
154
158
  end
155
159
  end
156
160
 
157
- result.to_yaml.gsub('---', '')
161
+ result.to_yaml.gsub(/^---/, '')
158
162
  end
159
163
 
160
164
  #
@@ -26,7 +26,7 @@ module Gorynich
26
26
  envs = ::Dir.glob(::Rails.root.join('config/environments/*.rb').to_s).map { |f| ::File.basename(f, '.rb') }
27
27
 
28
28
  ::File.open(file_path, 'w') do |f|
29
- f << cfg.deep_transform_keys(&:downcase).select { |k, _v| envs.include?(k) }.to_yaml.gsub('---', '')
29
+ f << cfg.deep_transform_keys(&:downcase).select { |k, _v| envs.include?(k) }.to_yaml.gsub(/^---/, '')
30
30
  end
31
31
  end
32
32
 
@@ -1,3 +1,3 @@
1
1
  module Gorynich
2
- VERSION = '1.3.2'
2
+ VERSION = '1.3.4'
3
3
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: gorynich
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.3.2.231715
4
+ version: 1.3.4.273062
5
5
  platform: ruby
6
6
  authors:
7
7
  - Poliev Alexey
@@ -9,7 +9,7 @@ authors:
9
9
  autorequire:
10
10
  bindir: bin
11
11
  cert_chain: []
12
- date: 2024-04-27 00:00:00.000000000 Z
12
+ date: 2024-11-13 00:00:00.000000000 Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
15
  name: diplomat
@@ -163,7 +163,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
163
163
  - !ruby/object:Gem::Version
164
164
  version: '0'
165
165
  requirements: []
166
- rubygems_version: 3.5.9
166
+ rubygems_version: 3.5.22
167
167
  signing_key:
168
168
  specification_version: 4
169
169
  summary: Multitenancy for Rails and subsystems