Sha256: 0c71cc0529e2eefeaece1c7b00c8e7fd1793d019fcb4092067aee64e7dae943d

Contents?: true

Size: 1.28 KB

Versions: 1

Compression:

Stored size: 1.28 KB

Contents

namespace :secrets do
  desc "Encrypt your secrets - rake secrets:encrypt"
  task :encrypt do
    puts "Attempting to encrypt..."
    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

1 entries across 1 versions & 1 rubygems

Version Path
super_top_secret-1.0.2 lib/tasks/super_top_secret_tasks.rake