lib/bbc/cosmos/config/aws.rb in bbc-cosmos-config-0.0.4 vs lib/bbc/cosmos/config/aws.rb in bbc-cosmos-config-0.0.5

- old
+ new

@@ -1,11 +1,12 @@ module BBC module Cosmos module Config class AWS - def initialize(ec2) + def initialize(ec2, s3) @ec2 = ec2 + @s3 = s3 end def tags instance.tags end @@ -16,10 +17,22 @@ def instance_id BBC::Cosmos.production? ? aws_instance_id : "instance_id" end + def config(config, path) + BBC::Cosmos.production? ? s3_config(config[:component_resources_bucket], path, config[:configuration][:commit]) : config[:configuration] + end + private + + def s3_config_location + tags['Renderer'] + end + + def s3_config(bucket, path, version) + JSON.parse(@s3.buckets[bucket].objects["#{path}/config/#{version}/#{s3_config_location}.json"], :symbolize_names => true) + end def instance BBC::Cosmos.production? ? aws_instance : dummy_instance end