Skip to content

Commit

Permalink
Update authentication.md
Browse files Browse the repository at this point in the history
  • Loading branch information
excid3 authored Feb 10, 2021
1 parent 500fb56 commit 3a79e7c
Showing 1 changed file with 5 additions and 3 deletions.
8 changes: 5 additions & 3 deletions docs/authentication.md
Original file line number Diff line number Diff line change
Expand Up @@ -22,9 +22,11 @@ If you want to use HTTP Basic Authentication, you can use this in your
module Madmin
class ApplicationController < Madmin::BaseController
http_basic_authenticate_with(
name: ENV['ADMIN_USERNAME'],
password: ENV['ADMIN_PASSWORD']
name: ENV['ADMIN_USERNAME'] || Rails.application.credentials.admin_username,
password: ENV['ADMIN_PASSWORD'] || Rails.application.credentials.admin_password
)
end
end
```
```

This will use ENV vars (if defined) or fallback to the Rails credentials for admin username and password.

0 comments on commit 3a79e7c

Please sign in to comment.