class Awsom::Config

Public Class Methods

new(config_path) click to toggle source
# File lib/awsom/config.rb, line 4
def initialize(config_path)
  @config_path = config_path
end

Public Instance Methods

config() click to toggle source
# File lib/awsom/config.rb, line 8
def config
  @config = {
    minion_config: {}
  }
  read_config
  @config
end

Private Instance Methods

aws_key(aws_key) click to toggle source
# File lib/awsom/config.rb, line 30
def aws_key(aws_key)
  set :aws_key, aws_key
  set :use_iam, false
end
aws_secret(aws_secret) click to toggle source
# File lib/awsom/config.rb, line 35
def aws_secret(aws_secret)
  set :aws_secret, aws_secret
  set :use_iam, false
end
minion_config(config) click to toggle source
# File lib/awsom/config.rb, line 26
def minion_config(config)
  set :minion_config, config
end
read(file, required: true) click to toggle source
# File lib/awsom/config.rb, line 48
def read(file, required: true)
  if not File.readable? file
    raise Error, "config: #{file} not readable" if required
    return
  end
  instance_eval(File.read(file), file)
rescue NoMethodError => e
  raise Error, "invalid option used in config: #{e.name}"
end
read_config() click to toggle source
# File lib/awsom/config.rb, line 44
def read_config
  read(@config_path, required: false)
end
region(region) click to toggle source
# File lib/awsom/config.rb, line 18
def region(region)
  set :region, region
end
set(key, value) click to toggle source
# File lib/awsom/config.rb, line 40
def set(key, value)
  @config.store key, value
end
vpc_id(vpc) click to toggle source
# File lib/awsom/config.rb, line 22
def vpc_id(vpc)
  set :vpc_id, vpc
end