Class: Sfn::Callback::ParametersStacks
- Inherits:
-
ParametersInfrastructure
- Object
- Sfn::Callback
- ParametersInfrastructure
- Sfn::Callback::ParametersStacks
- Defined in:
- lib/sfn-parameters/stacks.rb
Overview
Auto load stack parameters for single stack pattern
Constant Summary
Constants inherited from ParametersInfrastructure
Sfn::Callback::ParametersInfrastructure::VALID_EXTENSIONS
Instance Method Summary collapse
-
#load_file_for(stack_name) ⇒ Smash
Load the configuration file.
Methods inherited from ParametersInfrastructure
Methods included from SfnParameters::Utils
#lock_content, #unlock_content
Instance Method Details
#load_file_for(stack_name) ⇒ Smash
Load the configuration file
12 13 14 15 16 17 18 19 20 21 22 |
# File 'lib/sfn-parameters/stacks.rb', line 12 def load_file_for(stack_name) root_path = config.fetch(:sfn_parameters, :directory, "stacks") paths = Dir.glob(File.join(root_path, "#{stack_name}{#{VALID_EXTENSIONS.join(",")}}")).map(&:to_s) if paths.size > 1 raise ArgumentError.new "Multiple parameter file matches encountered! (#{paths.join(", ")})" elsif paths.empty? Smash.new else unlock_content(Bogo::Config.new(paths.first).data) end end |