Sha256: 1985e56372fb2641922dad631590478ae66600d515439ede8a8a8267d996aa1f
Contents?: true
Size: 1022 Bytes
Versions: 3
Compression:
Stored size: 1022 Bytes
Contents
require "json" module BBC module Cosmos module Config class Cosmos attr_reader :aws_config def initialize(aws_config) @aws_config = aws_config end def stack_name @aws_config.tags["aws:cloudformation:stack-name"] end def component_name @aws_config.tags["Component"].downcase end def component_config @component_config ||= @aws_config.config(parse_component_config, parse_component_config[:configuration][:path]) end private def parse_component_config JSON.parse(app_config_string, :symbolize_names => true) end def app_config_string File.open(config_location).read end def config_location BBC::Cosmos.production? ? cosmos_config_location : ENV["DEV_APP_CONF"] end def cosmos_config_location "/etc/#{component_name}/component_configuration.json" end end end end end
Version data entries
3 entries across 3 versions & 1 rubygems
Version | Path |
---|---|
bbc-cosmos-config-0.0.7 | lib/bbc/cosmos/config/cosmos.rb |
bbc-cosmos-config-0.0.6 | lib/bbc/cosmos/config/cosmos.rb |
bbc-cosmos-config-0.0.5 | lib/bbc/cosmos/config/cosmos.rb |