Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
Converts AWS_CREDENTIAL_FILE to a .fog one
#!/usr/bin/env ruby
require 'yaml'
unless filename = ENV['AWS_CREDENTIAL_FILE']
puts "No AWS_CREDENTIAL_FILE file found!"
exit 1
end
credentials = Hash[File.new(filename).each_line.map { |line| line.chomp.split('=') }]
econ = {
'econsultancy' =>
{
'aws_access_key_id' => credentials['AWSAccessKeyId'],
'aws_secret_access_key' => credentials['AWSSecretKey']
}
}
file = File.expand_path('.fog', '~')
File.open(file, 'w') { |f| f.write econ.to_yaml }
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment