Class: HerokuConfig::AwsRotate

Inherits:
Base
  • Object
show all
Includes:
AwsKeyNameMap
Defined in:
lib/heroku_config/aws_rotate.rb

Defined Under Namespace

Classes: MaxKeysError

Instance Method Summary collapse

Methods included from AwsKeyNameMap

#id_key_name, #secret_key_name

Methods inherited from Base

#config

Constructor Details

#initialize(options = {}) ⇒ AwsRotate

Returns a new instance of AwsRotate.



6
7
8
9
# File 'lib/heroku_config/aws_rotate.rb', line 6

def initialize(options={})
  @options = options
  @app = options[:app]
end

Instance Method Details

#runObject



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

def run
  key_id = config.get(id_key_name)
  unless key_id
    puts "WARN: No #{id_key_name} found for #{@app.color(:green)} app."
    if @options[:cli]
      puts "Exiting"
      exit 0
    else
      return
    end
  end

  aws_key = AwsKey.new(@options, key_id)
  aws_key.rotate
end