Module: Kongrations::CurrentEnvironment
- Defined in:
- lib/kongrations/current_environment.rb
Constant Summary collapse
- FILE_NAME =
'kongrations.yml'.freeze
Class Method Summary collapse
- .kong_admin_api_key ⇒ Object
- .kong_admin_url ⇒ Object
- .load!(name) ⇒ Object
- .migrations_folder ⇒ Object
- .name ⇒ Object
Class Method Details
.kong_admin_api_key ⇒ Object
37 38 39 |
# File 'lib/kongrations/current_environment.rb', line 37 def self.kong_admin_api_key @kong_admin_api_key end |
.kong_admin_url ⇒ Object
33 34 35 |
# File 'lib/kongrations/current_environment.rb', line 33 def self.kong_admin_url @kong_admin_url end |
.load!(name) ⇒ Object
10 11 12 13 14 15 16 17 18 19 20 21 22 23 |
# File 'lib/kongrations/current_environment.rb', line 10 def self.load!(name) yaml = File.read(FILE_NAME) template = ERB.new(yaml) yaml = template.result(binding) config = YAML.safe_load(yaml) environment = config['environments'].detect { |e| e['name'] == name } @migrations_folder = config.fetch('path', './migrations') @name = name @kong_admin_url = environment['kong-admin-url'] @kong_admin_api_key = environment['kong-admin-api-key'] end |
.migrations_folder ⇒ Object
25 26 27 |
# File 'lib/kongrations/current_environment.rb', line 25 def self.migrations_folder @migrations_folder end |
.name ⇒ Object
29 30 31 |
# File 'lib/kongrations/current_environment.rb', line 29 def self.name @name end |