Skip to content

Instantly share code, notes, and snippets.

@josedulanto
Created June 18, 2020 15:01
Show Gist options
  • Save josedulanto/401e29b5b371ad6c341b439c7cda4efc to your computer and use it in GitHub Desktop.
Save josedulanto/401e29b5b371ad6c341b439c7cda4efc to your computer and use it in GitHub Desktop.
Adds Sidekiq web admin to Rails API only with basic auth and custom URL
# Adds Sidekiq web admin to Rails API only with basic auth and custom URL
Sidekiq::Web.use(Rack::Auth::Basic) do |username, password|
username == Rails.application.credentials[Rails.env.to_sym][:sidekiqweb][:username] &&
password == Rails.application.credentials[Rails.env.to_sym][:sidekiqweb][:password]
end
mount(Sidekiq::Web => "/#{Time.now.strftime("%Y%m%d")}sidekiqadmin")
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment