Sha256: cf567b9fc0115d115c84cd16dd6867241a49996c3c134063a5cf9765e1912df2

Contents?: true

Size: 1.28 KB

Versions: 2

Compression:

Stored size: 1.28 KB

Contents

namespace :secrets do
  desc "Encrypt your secrets - rake secrets:encrypt"
  task :encrypt do
    puts "Attempting to decrypt..."
    if File.file?("config/application_secrets.yml")
      sh("aws kms encrypt --key-id arn:aws:kms:us-west-2:155751353262:alias/properties --plaintext fileb://config/application_secrets.yml --output text --query CiphertextBlob | base64 --decode > config/application_secrets.yml.enc")
    else
      puts "Error: File missing. config/application_secrets.yml is required."
    end
  end

  desc "Decrypt your secrets - rake secrets:decrypt"
  task :decrypt do
    puts "Attempting to decrypt..."
    if File.file?("config/application_secrets.yml.enc")
      sh("aws kms decrypt --ciphertext-blob fileb://config/application_secrets.yml.enc --output text --query Plaintext | base64 --decode > config/application_secrets.yml")
    else
      puts "Error: File missing. config/application_secrets.yml.enc is required."
    end

    if File.file?("config/application_keys.yml") && File.file?("config/application_secrets.yml")
      SuperTopSecret::Injector.generate_config("config/application_keys.yml", "config/application_secrets.yml")
    else
      puts "Error: File(s) missing. config/application_keys.yml && config/application_secrets.yml are both required."
    end
  end

end

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
super_top_secret-1.0.1 lib/tasks/super_top_secret_tasks.rake
super_top_secret-1.0.0 lib/tasks/super_top_secret_tasks.rake