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 +4 -4
- data/lib/gorynich/config.rb +8 -4
- data/lib/gorynich/fetchers/consul_secure.rb +1 -1
- data/lib/gorynich/version.rb +1 -1
- metadata +3 -3
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: c86ef9f339490757d3eae9bd623ab475f98f41a0811c591d48e7c265a9f69677
|
4
|
+
data.tar.gz: 10b7d0dd91f8bbc0ffb8e68ceced64f49deaf1786eadb32dea07f1e61baa78de
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: b26ed7637cbe6d0326f3f0a97cefc008897b30a8e43aa308cf7ee52ee3a0204fa1409e5b1225a0f99f0e049e0c5c453ada7a9ddf74ef118c31904b10bd56e4d9
|
7
|
+
data.tar.gz: bd37c26bc90f3ecd5e8554465c38d7176d383142fffacfba6b2b6ca13381946f840d27ca1b840e0d052f75af3229e3a5bda02061110ae8ebf95b4fb1b6efdcd8
|
data/lib/gorynich/config.rb
CHANGED
@@ -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]
|
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
|
|
data/lib/gorynich/version.rb
CHANGED
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.
|
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-
|
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.
|
166
|
+
rubygems_version: 3.5.22
|
167
167
|
signing_key:
|
168
168
|
specification_version: 4
|
169
169
|
summary: Multitenancy for Rails and subsystems
|