kumo_keisei 0.0.53 → 0.0.54
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/VERSION +1 -1
- data/lib/kumo_keisei/environment_config.rb +13 -2
- data/spec/lib/kumo_keisei/environment_config_spec.rb +24 -4
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: aafae086e285b92c93f77d21ab4938c4dc4458dd
|
4
|
+
data.tar.gz: de6b75f61452599be6dcbd375e0bef150ed7a07f
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 930367bd74af5b2ab2e423f41d123dd904fe33bf21c1035846ae9f0bd327b8eecaf517a2029ef0c9d81e07d5c5a887061f0c07cbe9fb7d365018744f1689fe7c
|
7
|
+
data.tar.gz: 665b7bab8e79ac469c3cfcf3da8c9697fd2866bbe9034a11409d538a4901f335684e3df8db684ad25a4a91c88c70396db41a2b1fcfc379df4843eaa46306f4d0
|
data/VERSION
CHANGED
@@ -1 +1 @@
|
|
1
|
-
0.0.
|
1
|
+
0.0.54
|
@@ -97,7 +97,13 @@ class KumoKeisei::EnvironmentConfig
|
|
97
97
|
end
|
98
98
|
|
99
99
|
def encrypted_env_secrets
|
100
|
-
@file_loader.load_config(env_secrets_file_name)
|
100
|
+
secrets = @file_loader.load_config(env_secrets_file_name)
|
101
|
+
|
102
|
+
if !secrets.empty?
|
103
|
+
secrets
|
104
|
+
else
|
105
|
+
@file_loader.load_config('development_secrets.yml')
|
106
|
+
end
|
101
107
|
end
|
102
108
|
|
103
109
|
def common_config
|
@@ -106,6 +112,11 @@ class KumoKeisei::EnvironmentConfig
|
|
106
112
|
|
107
113
|
def env_config
|
108
114
|
config = @file_loader.load_config(env_config_file_name)
|
109
|
-
|
115
|
+
|
116
|
+
if !config.empty?
|
117
|
+
config
|
118
|
+
else
|
119
|
+
@file_loader.load_config('development.yml')
|
120
|
+
end
|
110
121
|
end
|
111
122
|
end
|
@@ -87,6 +87,7 @@ describe KumoKeisei::EnvironmentConfig do
|
|
87
87
|
it 'adds injected config to the config hash' do
|
88
88
|
allow(file_loader).to receive(:load_config).with('common.yml').and_return(common_parameters)
|
89
89
|
allow(file_loader).to receive(:load_config).with(environment_config_file_name).and_return({})
|
90
|
+
allow(file_loader).to receive(:load_config).with('development.yml').and_return({})
|
90
91
|
|
91
92
|
expect(subject).to eq({ "stack_name" => "okonomiyaki", "injected" => "yes" })
|
92
93
|
end
|
@@ -98,16 +99,18 @@ describe KumoKeisei::EnvironmentConfig do
|
|
98
99
|
it 'creates a array containing an aws formatted parameter hash' do
|
99
100
|
allow(file_loader).to receive(:load_config).with('common.yml').and_return(common_parameters)
|
100
101
|
allow(file_loader).to receive(:load_config).with(environment_config_file_name).and_return({})
|
102
|
+
allow(file_loader).to receive(:load_config).with('development.yml').and_return({})
|
101
103
|
|
102
104
|
expect(subject).to eq('stack_name' => 'okonomiyaki')
|
103
105
|
end
|
104
106
|
end
|
105
107
|
|
106
108
|
context 'merging common and environment specific configurations' do
|
109
|
+
let(:environment_config) { {'image' => 'ami-5678'} }
|
110
|
+
|
107
111
|
context 'with environmental overrides' do
|
108
112
|
let(:parameter_template) { "image: <%= config['image'] %>" }
|
109
113
|
let(:common_config) { {'image' => 'ami-1234'} }
|
110
|
-
let(:environment_config) { {'image' => 'ami-5678'} }
|
111
114
|
let(:env_name) { 'development' }
|
112
115
|
|
113
116
|
it 'replaces the common value with the env value' do
|
@@ -117,6 +120,14 @@ describe KumoKeisei::EnvironmentConfig do
|
|
117
120
|
expect(subject).to eq('image' => 'ami-5678')
|
118
121
|
end
|
119
122
|
end
|
123
|
+
|
124
|
+
it 'falls back to a default environment if the requested one does not exist' do
|
125
|
+
allow(file_loader).to receive(:load_config).with('common.yml').and_return({})
|
126
|
+
allow(file_loader).to receive(:load_config).with("#{env_name}.yml").and_return({})
|
127
|
+
expect(file_loader).to receive(:load_config).with("development.yml").and_return(environment_config)
|
128
|
+
|
129
|
+
expect(subject).to eq('image' => 'ami-5678')
|
130
|
+
end
|
120
131
|
end
|
121
132
|
end
|
122
133
|
|
@@ -135,26 +146,35 @@ describe KumoKeisei::EnvironmentConfig do
|
|
135
146
|
allow(kms).to receive(:decrypt).with(crypted_password).and_return(plain_text_password)
|
136
147
|
end
|
137
148
|
|
138
|
-
it '
|
149
|
+
it 'decrypts common secrets' do
|
139
150
|
allow(file_loader).to receive(:load_config).with('common_secrets.yml').and_return(secrets)
|
140
151
|
allow(file_loader).to receive(:load_config).with("#{env_name}_secrets.yml").and_return({})
|
152
|
+
allow(file_loader).to receive(:load_config).with("development_secrets.yml").and_return({})
|
141
153
|
|
142
154
|
expect(subject).to eq('secret_password' => plain_text_password)
|
143
155
|
end
|
144
156
|
|
145
|
-
it '
|
157
|
+
it 'decrypts environment secrets' do
|
146
158
|
allow(file_loader).to receive(:load_config).with('common_secrets.yml').and_return({})
|
147
159
|
allow(file_loader).to receive(:load_config).with("#{env_name}_secrets.yml").and_return(secrets)
|
148
160
|
|
149
161
|
expect(subject).to eq('secret_password' => plain_text_password)
|
150
162
|
end
|
151
163
|
|
152
|
-
it '
|
164
|
+
it 'gives preference to environment secrets' do
|
153
165
|
allow(file_loader).to receive(:load_config).with('common_secrets.yml').and_return(secrets)
|
154
166
|
allow(file_loader).to receive(:load_config).with("#{env_name}_secrets.yml").and_return(env_secrets)
|
155
167
|
allow(kms).to receive(:decrypt).with(crypted_env_password).and_return(plain_text_env_password)
|
156
168
|
|
157
169
|
expect(subject).to eq('secret_password' => plain_text_env_password)
|
158
170
|
end
|
171
|
+
|
172
|
+
it 'falls back to a default environment if the requested one does not exist' do
|
173
|
+
allow(file_loader).to receive(:load_config).with('common_secrets.yml').and_return({})
|
174
|
+
allow(file_loader).to receive(:load_config).with("#{env_name}_secrets.yml").and_return({})
|
175
|
+
expect(file_loader).to receive(:load_config).with("development_secrets.yml").and_return(secrets)
|
176
|
+
|
177
|
+
expect(subject).to eq('secret_password' => plain_text_password)
|
178
|
+
end
|
159
179
|
end
|
160
180
|
end
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: kumo_keisei
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.0.
|
4
|
+
version: 0.0.54
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Redbubble
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2016-05-
|
11
|
+
date: 2016-05-11 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: aws-sdk
|