Sha256: f76fed4e3a007f87031289a53eca81be783d062971568e0ce18cf17337baad4b

Contents?: true

Size: 681 Bytes

Versions: 3

Compression:

Stored size: 681 Bytes

Contents

module Meroku
  module CLI
    # 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'
        attempt_download unless File.exist?(env_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`
      end
    end
  end
end

Version data entries

3 entries across 3 versions & 1 rubygems

Version Path
meroku-2.0.21 lib/meroku/cli/secrets.rb
meroku-2.0.20 lib/meroku/cli/secrets.rb
meroku-2.0.19 lib/meroku/cli/secrets.rb