bbc-cosmos-config 0.1.2 → 0.2.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/lib/bbc/cosmos/config/aws.rb +10 -6
- data/lib/bbc/cosmos/config/cosmos.rb +6 -5
- data/lib/bbc/cosmos/config/version.rb +1 -1
- 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: 65576a9095db870fd1b74e0b7aa89a41c888d5e4
|
4
|
+
data.tar.gz: 2dda163f88bb77a9ddebccbe264bca8f620ada17
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 2428006bfe08f0dd2b85c3aac40cc5bb761925d7857aa8440930901d61f7d4d6c90e69aef270b7fc241d9f303e2b9f5b2ce6b0cd6da875d202fb27c03b1f4697
|
7
|
+
data.tar.gz: 6247e0b3d8c74eec1e7dc3f2e9ccf21e6cdad3f02c35b9ff8d4c92e75b065c8aaf1a06f5bd4d491fd25b10bbcb80ee1f8325ca73783f11859f4f37d1371b20ba
|
@@ -19,18 +19,22 @@ module BBC
|
|
19
19
|
@instance_id ||= BBC::Cosmos.production? ? aws_instance_id : "instance_id"
|
20
20
|
end
|
21
21
|
|
22
|
-
def config(config, path)
|
23
|
-
@config ||= BBC::Cosmos.production? ? s3_config(config[:component_resources_bucket], path, config[:environment], config[:configuration][:commit]) : config[:configuration]
|
24
|
-
end
|
25
|
-
|
26
22
|
private
|
27
23
|
|
28
24
|
def s3_config_location
|
29
25
|
tags['AppName']
|
30
26
|
end
|
31
27
|
|
32
|
-
def s3_config(
|
33
|
-
|
28
|
+
def s3_config(config)
|
29
|
+
path = [
|
30
|
+
config[:configuration][:config_path],
|
31
|
+
config[:environment],
|
32
|
+
'config',
|
33
|
+
config[:configuration][:commit],
|
34
|
+
"#{s3_config_location}.json"
|
35
|
+
].join('/')
|
36
|
+
|
37
|
+
JSON.parse(@s3.buckets[config[:component_resources_bucket]].objects[path].read, :symbolize_names => true)
|
34
38
|
end
|
35
39
|
|
36
40
|
def instance
|
@@ -23,16 +23,17 @@ module BBC
|
|
23
23
|
end
|
24
24
|
|
25
25
|
def component_config
|
26
|
-
|
27
|
-
parse_component_config,
|
28
|
-
parse_component_config[:configuration][:config_path]
|
29
|
-
)
|
26
|
+
load_config_from_s3? ? @aws_config.s3_config(parse_component_config) : parse_component_config[:configuration]
|
30
27
|
end
|
31
28
|
|
32
29
|
private
|
33
30
|
|
31
|
+
def load_config_from_s3?
|
32
|
+
parse_component_config[:configuration].include?(:config_path) && BBC::Cosmos.production?
|
33
|
+
end
|
34
|
+
|
34
35
|
def parse_component_config
|
35
|
-
JSON.parse(app_config_string, :symbolize_names => true)
|
36
|
+
@parse_component_config ||= JSON.parse(app_config_string, :symbolize_names => true)
|
36
37
|
end
|
37
38
|
|
38
39
|
def app_config_string
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: bbc-cosmos-config
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.
|
4
|
+
version: 0.2.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Robert Kenny
|
@@ -206,7 +206,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
206
206
|
version: '0'
|
207
207
|
requirements: []
|
208
208
|
rubyforge_project:
|
209
|
-
rubygems_version: 2.
|
209
|
+
rubygems_version: 2.2.2
|
210
210
|
signing_key:
|
211
211
|
specification_version: 4
|
212
212
|
summary: Config wrapper gem for Ruby apps running on Cosmos
|