Skip to content

Commit 175f153

Browse files
committed
Fix setting basic auth config by hand
1 parent 66f829f commit 175f153

File tree

2 files changed

+17
-8
lines changed

2 files changed

+17
-8
lines changed

README.md

+15-6
Original file line numberDiff line numberDiff line change
@@ -76,6 +76,15 @@ To set them up for different environments you can use the `RAILS_ENV` environmen
7676
RAILS_ENV=production bin/rails mission_control:jobs:authentication:configure
7777
```
7878

79+
User and password can also be configured by hand like this:
80+
81+
```ruby
82+
Rails.application.configure do
83+
MissionControl::Jobs.http_basic_auth_user = "dev"
84+
MissionControl::Jobs.http_basic_auth_password = "secret"
85+
end
86+
```
87+
7988
#### Custom authentication
8089

8190
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:
@@ -158,19 +167,19 @@ SERVERS_BY_APP.each do |app, servers|
158167
end
159168

160169
# Default:
161-
#
170+
#
162171
# @return Array<String, ActiveJob::QueueAdapters::Base)
163172
# An array where:
164173
# * the String represents the symbolic name for this server within the UI
165174
# * ActiveJob::QueueAdapters::Base adapter instance used to access this Application Server/Service
166-
[ server, queue_adapter ]
167-
175+
[ server, queue_adapter ]
176+
168177
# Optional return formats:
169-
#
178+
#
170179
# @return Array<String, Array<ActiveJob::QueueAdapters::Base>>
171-
# * This is equivalent, and behaves identically to, the format the default format above.
180+
# * This is equivalent, and behaves identically to, the format the default format above.
172181
# [ server, [ queue_adapter ]] # without optional backtrace cleaner
173-
#
182+
#
174183
# @return Array<String, Array<ActiveJob::QueueAdapters::Base, ActiveSupport::BacktraceCleaner>>
175184
# * This format adds an optional ActiveSupport::BacktraceCleaner to override the system wide
176185
# backtrace cleaner for *this* Application Server/Service.

lib/mission_control/jobs/engine.rb

+2-2
Original file line numberDiff line numberDiff line change
@@ -35,8 +35,8 @@ class Engine < ::Rails::Engine
3535
end
3636

3737
initializer "mission_control-jobs.http_basic_auth" do |app|
38-
MissionControl::Jobs.http_basic_auth_user = app.credentials.dig(:mission_control, :http_basic_auth_user)
39-
MissionControl::Jobs.http_basic_auth_password = app.credentials.dig(:mission_control, :http_basic_auth_password)
38+
MissionControl::Jobs.http_basic_auth_user ||= app.credentials.dig(:mission_control, :http_basic_auth_user)
39+
MissionControl::Jobs.http_basic_auth_password ||= app.credentials.dig(:mission_control, :http_basic_auth_password)
4040
end
4141

4242
initializer "mission_control-jobs.active_job.extensions" do

0 commit comments

Comments
 (0)