Sha256: d3b7f5351ae1ab7c12e2f71822f2e9c2d87697e08b34ddeeb70e4230e04da22f

Contents?: true

Size: 1.07 KB

Versions: 5

Compression:

Stored size: 1.07 KB

Contents

require 'rake'
require 'optparse'
require 'securerandom'

namespace :harmony do
  desc 'Generate a key'
  task :generate_key do
    puts SecureRandom.hex
  end
  
  desc 'Write initial secrets to encrypted file.'
  task :write_secrets  do |t, args|
    abort "ENV['SEKRETS_KEY'] must be set." unless ENV['SEKRETS_KEY'] 
    abort "ENV['QUEUE_NAME'] must be set." unless ENV['QUEUE_NAME']
    abort "ENV['STAGING_AMPQ_URL'] must be set." unless ENV['STAGING_AMPQ_URL'] 
    abort "ENV['PRODUCTION_AMPQ_URL'] must be set." unless ENV['PRODUCTION_AMPQ_URL'] 
        
    secrets = {
      development: {harmony_queue: ENV['QUEUE_NAME'], ampq_address: ENV['STAGING_AMPQ_URL'], ampq_vhost: 'harmony-staging-queue'},
      staging: {harmony_queue: ENV['QUEUE_NAME'], ampq_address: ENV['STAGING_AMPQ_URL'], ampq_vhost: 'harmony-staging-queue'},
      production: {harmony_queue: ENV['QUEUE_NAME'], ampq_address: ENV['PRODUCTION_AMPQ_URL'], ampq_vhost: 'harmony'}
    }
    `ruby -r yaml -e'puts(#{secrets}.to_yaml)' | sekrets write config/settings.yml.enc --key #{ENV['SEKRETS_KEY']}`
  end  
end

Version data entries

5 entries across 5 versions & 1 rubygems

Version Path
harmony-service-0.7.0 lib/harmony/service/rake_tasks.rb
harmony-service-0.6.0 lib/harmony/service/rake_tasks.rb
harmony-service-0.5.8 lib/harmony/service/rake_tasks.rb
harmony-service-0.5.7 lib/harmony/service/rake_tasks.rb
harmony-service-0.5.6 lib/harmony/service/rake_tasks.rb