Sha256: f09fff7c5cbd7f133a1243823e3f8f5e9e57f4f046a18ab65d87c14d449cf312

Contents?: true

Size: 546 Bytes

Versions: 1

Compression:

Stored size: 546 Bytes

Contents

require_relative '../password_hasher'

class Balrog::InstallGenerator < Rails::Generators::Base

  desc "Creates a balrog initializer and configures it with the provided password (you'll be prompted for it)."
  def create_initializer_file
    password_hash = PasswordHasher.encrypt_password
    contents = <<~EOF
      Rails.application.config.middleware.use Balrog::Middleware do
        password_hash '#{password_hash}'
        set_session_expiry 30.minutes
      end
    EOF
    create_file "config/initializers/balrog.rb", contents
  end
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
balrog-1.1.0 lib/balrog/generators/install_generator.rb