Class: CfDeployer::ConfigLoader
- Inherits:
-
Object
- Object
- CfDeployer::ConfigLoader
- Defined in:
- lib/cf_deployer/config_loader.rb
Class Method Summary collapse
Instance Method Summary collapse
Class Method Details
.erb_to_json(filename, config) ⇒ Object
4 5 6 7 8 9 10 11 12 |
# File 'lib/cf_deployer/config_loader.rb', line 4 def self.erb_to_json filename, config json_file = File.join(config[:config_dir], "#{filename}.json") raise ApplicationError.new("#{json_file} is missing") unless File.exists?(json_file) CfDeployer::Log.info "ERBing JSON for #{filename}" ERB.new(File.read(json_file)).result(binding) rescue RuntimeError,TypeError,NoMethodError => e self.new.send :error_document, File.read(json_file) raise e end |
Instance Method Details
#load(options) ⇒ Object
14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 |
# File 'lib/cf_deployer/config_loader.rb', line 14 def load() config_text = File.read([:'config-file']) erbed_config = erb_with_environment_and_region(config_text, [:environment], [:region]) yaml = symbolize_all_keys(load_yaml(erbed_config)) @config = .merge(yaml) @config[:components] ||= {} @config[:settings] ||= {} @config[:environments] ||= {} @config[:tags] ||= {} @config[:notify] ||= [] get_targets copy_config_dir merge_hash(:settings) merge_hash(:inputs) merge_hash(:tags) merge_array(:notify) copy_region_app_env_component get_cf_template_keys('Parameters') get_cf_template_keys('Outputs') set_default_settings @config.delete(:settings) @config end |