Method: CFnDK::GlobalConfig#initialize

Defined in:
lib/cfndk/global_config.rb

#initialize(data, option) ⇒ GlobalConfig

Returns a new instance of GlobalConfig.



4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
# File 'lib/cfndk/global_config.rb', line 4

def initialize(data, option)
  @timeout_in_minutes = 1
  @s3_template_bucket = 'cfndk-templates'
  @s3_template_hash = Uuid.instance.uuid
  @region = ENV['AWS_REGION'] || 'us-east-1'
  @package = false
  @profile = ENV['AWS_PROFILE'] || nil
  return unless data['global'].is_a?(Hash)
  @timeout_in_minutes = data['global']['timeout_in_minutes'] || 1
  @s3_template_bucket = data['global']['s3_template_bucket'] || 'cfndk-templates'
  @region = data['global']['region'] || ENV['AWS_REGION'] || 'us-east-1'
  @package = data['global']['package'] === 'true' ? true : false
  @role_arn = data['global']['role_arn'] || nil
  @profile = ENV['AWS_PROFILE'] || data['global']['default_profile'] || nil
  @pre_command = data['global']['pre_command'] || nil
  @post_command = data['global']['post_command'] || nil
end