Class: BBC::Cosmos::Config::Cosmos
- Inherits:
-
Object
- Object
- BBC::Cosmos::Config::Cosmos
- Defined in:
- lib/bbc/cosmos/config/cosmos.rb
Instance Attribute Summary collapse
-
#aws_config ⇒ Object
readonly
Returns the value of attribute aws_config.
Instance Method Summary collapse
- #app_name ⇒ Object
- #component_config ⇒ Object
- #component_name ⇒ Object
- #config ⇒ Object
- #environment ⇒ Object
-
#initialize(aws_config) ⇒ Cosmos
constructor
A new instance of Cosmos.
- #stack_name ⇒ Object
- #version ⇒ Object
Constructor Details
#initialize(aws_config) ⇒ Cosmos
Returns a new instance of Cosmos.
9 10 11 |
# File 'lib/bbc/cosmos/config/cosmos.rb', line 9 def initialize(aws_config) @aws_config = aws_config end |
Instance Attribute Details
#aws_config ⇒ Object (readonly)
Returns the value of attribute aws_config.
7 8 9 |
# File 'lib/bbc/cosmos/config/cosmos.rb', line 7 def aws_config @aws_config end |
Instance Method Details
#app_name ⇒ Object
17 18 19 |
# File 'lib/bbc/cosmos/config/cosmos.rb', line 17 def app_name @aws_config.["AppName"] end |
#component_config ⇒ Object
25 26 27 |
# File 'lib/bbc/cosmos/config/cosmos.rb', line 25 def component_config load_config_from_s3? ? @aws_config.s3_config(config) : config[:configuration] end |
#component_name ⇒ Object
21 22 23 |
# File 'lib/bbc/cosmos/config/cosmos.rb', line 21 def component_name @aws_config.["BBCComponent"].downcase end |
#config ⇒ Object
29 30 31 |
# File 'lib/bbc/cosmos/config/cosmos.rb', line 29 def config @config ||= JSON.parse(app_config_string, :symbolize_names => true) end |
#environment ⇒ Object
33 34 35 |
# File 'lib/bbc/cosmos/config/cosmos.rb', line 33 def environment BBC::Cosmos.production? ? config[:environment] : ENV.fetch('APP_ENV', 'development') end |
#stack_name ⇒ Object
13 14 15 |
# File 'lib/bbc/cosmos/config/cosmos.rb', line 13 def stack_name @aws_config.["aws:cloudformation:stack-name"] end |
#version ⇒ Object
37 38 39 |
# File 'lib/bbc/cosmos/config/cosmos.rb', line 37 def version BBC::Cosmos.production? ? config[:release] : "#{environment}-version" end |