lib/meroku/cli/secrets.rb in meroku-2.0.21 vs lib/meroku/cli/secrets.rb in meroku-2.0.22

- old
+ new

@@ -3,18 +3,21 @@ # Logic related to apiusername, apipassword and the env file module Secrets def self.load(admin: false) return unless admin env_file = Dir.home + '/.meroku/meroku.env' + pem_file = Dir.home + '/.meroku/meroku.id_rsa' attempt_download unless File.exist?(env_file) + attempt_download unless File.exist?(pem_file) Dotenv.load(env_file) end def self.attempt_download abort 'ENV["SECRET"] not found' unless ENV['SECRET'] FileUtils.mkdir_p "#{Dir.home}/.meroku" `curl -so ~/.meroku/meroku.env https://s3.amazonaws.com/#{ENV['SECRET']}/meroku.env` `curl -so ~/.meroku/meroku.id_rsa https://s3.amazonaws.com/#{ENV['SECRET']}/meroku.id_rsa` + FileUtils.chmod 0400, "#{Dir.home}/.meroku/meroku.id_rsa" end end end end