Class: OpsWorks::Config

Inherits:
Object
  • Object
show all
Defined in:
lib/opsworks/config.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initializeConfig

Returns a new instance of Config.



11
12
13
14
15
16
17
18
19
20
21
22
23
24
# File 'lib/opsworks/config.rb', line 11

def initialize
  file = ENV["AWS_CONFIG_FILE"] || "#{ENV['HOME']}/.aws/config"
  raise "AWS config file not found" unless File.exists? file
  ini = IniFile.load(file)

  aws_config = ini['default']
  AWS.config(
    access_key_id: aws_config["aws_access_key_id"],
    secret_access_key: aws_config["aws_secret_access_key"],
  )

  @stacks = ini['opsworks']['stack-id'].split(',').map(&:strip)
  @ssh_user_name = ini['opsworks']['ssh-user-name'].strip
end

Instance Attribute Details

#ssh_user_nameObject (readonly)

Returns the value of attribute ssh_user_name.



9
10
11
# File 'lib/opsworks/config.rb', line 9

def ssh_user_name
  @ssh_user_name
end

#stacksObject (readonly)

Returns the value of attribute stacks.



9
10
11
# File 'lib/opsworks/config.rb', line 9

def stacks
  @stacks
end