Class: HerokuConfig::AwsRotateAll

Inherits:
Base
  • Object
show all
Defined in:
lib/heroku_config/aws_rotate_all.rb

Instance Method Summary collapse

Methods inherited from Base

#config

Constructor Details

#initialize(options = {}) ⇒ AwsRotateAll

Returns a new instance of AwsRotateAll.



3
4
5
6
# File 'lib/heroku_config/aws_rotate_all.rb', line 3

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

Instance Method Details

#appsObject



24
25
26
27
# File 'lib/heroku_config/aws_rotate_all.rb', line 24

def apps
  lines = IO.readlines(@file).map(&:strip).reject(&:empty?)
  lines.map { |l| l.split(':') }
end

#runObject



8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
# File 'lib/heroku_config/aws_rotate_all.rb', line 8

def run
  if ENV['HEROKU_CONFIG_TEST']
    puts "NOOP"
    return
  end

  apps.each do |app, id_key_name, secret_key_name|
    options = @options.merge(
      app: app,
      id_key_name: id_key_name || 'AWS_ACCESS_KEY_ID',
      secret_key_name: secret_key_name || 'AWS_SECRET_ACCESS_KEY',
    )
    AwsRotate.new(options).run
  end
end