Skip to content

Single‐File Configuration

Janko Marohnić edited this page Aug 29, 2023 · 1 revision

The rodauth-rails gem recommends using named auth classes for introspection and easier scaling. But you can also have all your Rodauth configuration contained inside the Rodauth app class:

# app/misc/rodauth_app.rb
class RodauthApp < Rodauth::Rails::App
  # primary configuration
  configure do
    enable :login, :logout, :create_account, :verify_account
    # ...
  end

  # secondary configuration
  configure(:admin) do
    enable :email_auth, :single_session
    # ...
  end

  route do |r|
    r.rodauth
    r.rodauth(:admin)
  end
end
Clone this wiki locally