Sha256: 33a6a705d8e6a95bb114fb6355df45bd68f4302e54dd0d29cc83862b3c763776
Contents?: true
Size: 928 Bytes
Versions: 8
Compression:
Stored size: 928 Bytes
Contents
class GlobalSessionAuthorityGenerator < Rails::Generator::Base def initialize(runtime_args, runtime_options = {}) super @app_name = File.basename(::Rails.root) @auth_name = args.shift raise ArgumentError, "Must specify name for global session authority, e.g. 'prod'" unless @auth_name end def manifest record do |m| new_key = OpenSSL::PKey::RSA.generate( 1024 ) new_public = new_key.public_key.to_pem new_private = new_key.to_pem dest_dir = File.join(::Rails.root, 'config', 'authorities') FileUtils.mkdir_p(dest_dir) File.open(File.join(dest_dir, @auth_name + ".pub"), 'w') do |f| f.puts new_public end File.open(File.join(dest_dir, @auth_name + ".key"), 'w') do |f| f.puts new_private end puts "***" puts "*** Don't forget to delete config/authorities/#{@auth_name}.key" puts "***" end end end
Version data entries
8 entries across 8 versions & 1 rubygems