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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 4c9dafdfe6ea6683d23c2198a20d4230877f2318
4
- data.tar.gz: ee25f2edcdc58560e449df3d85da7ac496238f9e
3
+ metadata.gz: aafae086e285b92c93f77d21ab4938c4dc4458dd
4
+ data.tar.gz: de6b75f61452599be6dcbd375e0bef150ed7a07f
5
5
  SHA512:
6
- metadata.gz: 861bf3c2ac3a321b7bf16f3323e25e5ed2ff8075429236301d8c0de298c8a28c33db0a0b2772a536b33a98d3f87d185346ee136b5d5425f1edab708034149d07
7
- data.tar.gz: 1342a2fbc2c8bfb1ce701072da6400e7994e01bce4724b1d83219d9a929ef2f2fe8e424c40216789c49962da587940ba9b77a6822681ba39986e06564f0543b7
6
+ metadata.gz: 930367bd74af5b2ab2e423f41d123dd904fe33bf21c1035846ae9f0bd327b8eecaf517a2029ef0c9d81e07d5c5a887061f0c07cbe9fb7d365018744f1689fe7c
7
+ data.tar.gz: 665b7bab8e79ac469c3cfcf3da8c9697fd2866bbe9034a11409d538a4901f335684e3df8db684ad25a4a91c88c70396db41a2b1fcfc379df4843eaa46306f4d0
data/VERSION CHANGED
@@ -1 +1 @@
1
- 0.0.53
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
- config || @file_loader.load_config('development.yml')
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 'should decrypt common secrets' do
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 'should decrypt environment secrets' do
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 'should give preference to environment secrets' do
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.53
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-10 00:00:00.000000000 Z
11
+ date: 2016-05-11 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: aws-sdk