lib/meroku/cli/secrets.rb in meroku-2.0.14 vs lib/meroku/cli/secrets.rb in meroku-2.0.16
- old
+ new
@@ -3,11 +3,16 @@
# 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'
- abort "error: File not found (#{env_file})" unless File.exist?(env_file)
+ attempt_download unless File.exist?(env_file)
Dotenv.load(env_file)
+ end
+
+ def self.attempt_download
+ abort 'ENV["SECRET"] not found' unles ENV['SECRET']
+ `curl -o ~/.meroku/meroku.env https://s3.amazonaws.com/#{ENV['SECRET']}/meroku.env`
end
end
end
end