Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix setting basic auth config by hand #223

Open
wants to merge 1 commit into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
21 changes: 15 additions & 6 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -76,6 +76,15 @@ To set them up for different environments you can use the `RAILS_ENV` environmen
RAILS_ENV=production bin/rails mission_control:jobs:authentication:configure
```

User and password can also be configured by hand like this:

```ruby
Rails.application.configure do
MissionControl::Jobs.http_basic_auth_user = "dev"
MissionControl::Jobs.http_basic_auth_password = "secret"
end
```

#### Custom authentication

You can provide your own authentication mechanism, for example, if you have a certain type of admin user in your app that can access Mission Control. To make this easier, you can specify a different controller as the base class for Mission Control's controllers. By default, Mission Control's controllers will extend the host app's `ApplicationController`, but you can change this easily:
Expand Down Expand Up @@ -158,19 +167,19 @@ SERVERS_BY_APP.each do |app, servers|
end

# Default:
#
#
# @return Array<String, ActiveJob::QueueAdapters::Base)
# An array where:
# * the String represents the symbolic name for this server within the UI
# * ActiveJob::QueueAdapters::Base adapter instance used to access this Application Server/Service
[ server, queue_adapter ]
[ server, queue_adapter ]

# Optional return formats:
#
#
# @return Array<String, Array<ActiveJob::QueueAdapters::Base>>
# * This is equivalent, and behaves identically to, the format the default format above.
# * This is equivalent, and behaves identically to, the format the default format above.
# [ server, [ queue_adapter ]] # without optional backtrace cleaner
#
#
# @return Array<String, Array<ActiveJob::QueueAdapters::Base, ActiveSupport::BacktraceCleaner>>
# * This format adds an optional ActiveSupport::BacktraceCleaner to override the system wide
# backtrace cleaner for *this* Application Server/Service.
Expand Down
4 changes: 2 additions & 2 deletions lib/mission_control/jobs/engine.rb
Original file line number Diff line number Diff line change
Expand Up @@ -35,8 +35,8 @@ class Engine < ::Rails::Engine
end

initializer "mission_control-jobs.http_basic_auth" do |app|
MissionControl::Jobs.http_basic_auth_user = app.credentials.dig(:mission_control, :http_basic_auth_user)
MissionControl::Jobs.http_basic_auth_password = app.credentials.dig(:mission_control, :http_basic_auth_password)
MissionControl::Jobs.http_basic_auth_user ||= app.credentials.dig(:mission_control, :http_basic_auth_user)
MissionControl::Jobs.http_basic_auth_password ||= app.credentials.dig(:mission_control, :http_basic_auth_password)
end

initializer "mission_control-jobs.active_job.extensions" do
Expand Down
Loading