Skip to content

Commit b11ef80

Browse files
morgothrosa
authored andcommitted
Fix setting basic auth config by hand
1 parent 38bfcb2 commit b11ef80

File tree

2 files changed

+17
-8
lines changed

2 files changed

+17
-8
lines changed

README.md

Lines changed: 15 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -74,6 +74,15 @@ To set them up for different environments you can use the `RAILS_ENV` environmen
7474
RAILS_ENV=production bin/rails mission_control:jobs:authentication:configure
7575
```
7676

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

7988
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:
@@ -156,19 +165,19 @@ SERVERS_BY_APP.each do |app, servers|
156165
end
157166

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

lib/mission_control/jobs/engine.rb

Lines changed: 2 additions & 2 deletions
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)