class HerokuConfig::AwsRotateAll

Public Class Methods

new(options={}) click to toggle source
# File lib/heroku_config/aws_rotate_all.rb, line 3
def initialize(options={})
  @options = options
  @file = options[:file]
end

Public Instance Methods

apps() click to toggle source
# 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
run() click to toggle source
# 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