From 1f6fe992945b8d77c5d1ce31fc988f56bf7890d1 Mon Sep 17 00:00:00 2001 From: Tom Naessens Date: Sun, 19 May 2024 14:48:23 +0200 Subject: [PATCH] Use devise authentication for Sidekiq dashboard --- config/routes.rb | 5 ++--- config/secrets.yml | 8 -------- 2 files changed, 2 insertions(+), 11 deletions(-) diff --git a/config/routes.rb b/config/routes.rb index bc74727e..87c915c7 100644 --- a/config/routes.rb +++ b/config/routes.rb @@ -6,10 +6,9 @@ # Sidekiq UI require 'sidekiq/web' - Sidekiq::Web.use(Rack::Auth::Basic) do |username, password| - username == Rails.application.secrets.sidekiq[:basic_auth][:username] && password == Rails.application.secrets.sidekiq[:basic_auth][:password] + authenticate :user, -> (user) { user.admin? } do + mount Sidekiq::Web => '/sidekiq' end - mount Sidekiq::Web => '/sidekiq' # PG Hero authenticate :user, -> (user) { user.admin? } do diff --git a/config/secrets.yml b/config/secrets.yml index f7eb9950..563a9375 100644 --- a/config/secrets.yml +++ b/config/secrets.yml @@ -7,10 +7,6 @@ development: omniauth_client_id: 'tomtest' omniauth_client_secret: 'blargh' dsa_key: '#development#' - sidekiq: - basic_auth: - username: dhh - password: zeusisdemax test: secret_key_base: 24f28e9f092ff3849df2fcfaf5a0a56a18f098f314a369ea619171a0d47eaea9f0458c25572c52b4cc8c4823d75e2ea5f6477dfcc1e7b5ea46d4ca2be22cfb84 @@ -28,7 +24,3 @@ production: omniauth_client_id: <%= ENV["OMNIAUTH_CLIENT_ID"] %> omniauth_client_secret: <%= ENV["OMNIAUTH_CLIENT_SECRET"] %> dsa_key: <%= ENV["DSA_KEY"] %> - sidekiq: - basic_auth: - username: <%= ENV["SIDEKIQ_USERNAME"] %> - password: <%= ENV["SIDEKIQ_PASSWORD"] %>