Last active
October 25, 2017 14:45
-
-
Save DmytroVasin/89e4ee21637d9981ee4ce2b32525b3a2 to your computer and use it in GitHub Desktop.
Non splited file
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
require 'sidekiq/web' | |
Sidekiq::Web.use Rack::Auth::Basic do |username, password| | |
# NOTE: https://github.com/mperham/sidekiq/wiki/Monitoring | |
ActiveSupport::SecurityUtils.secure_compare(::Digest::SHA256.hexdigest(username), ::Digest::SHA256.hexdigest(ENV.fetch('ADMIN_NAME'))) & | |
ActiveSupport::SecurityUtils.secure_compare(::Digest::SHA256.hexdigest(password), ::Digest::SHA256.hexdigest(ENV.fetch('ADMIN_PASSWORD'))) | |
end if Rails.env.production? | |
Rails.application.routes.draw do | |
mount Sidekiq::Web, at: '/sidekiq' | |
root to: 'dashboards#show' | |
ActiveAdmin.routes(self) | |
devise_for :users, skip: [:sessions, :registrations, :passwords, :confirmations] | |
devise_scope :user do | |
# Sessions: | |
post 'auth/sign_in', to: 'auth/sessions#create', as: :user_session, defaults: { format: 'js' } | |
get 'auth/sign_out', to: 'auth/sessions#destroy', as: :destroy_user_session, defaults: { format: 'html' } | |
# Registrations: | |
post 'auth', to: 'auth/registrations#create', as: :user_registration, defaults: { format: 'js' } | |
# Passwords | |
post 'auth/password', to: 'auth/passwords#create', defaults: { format: 'js' } | |
get 'auth/password', to: 'auth/passwords#edit', as: :edit_user_password, defaults: { format: 'html' } | |
put 'auth/password', to: 'auth/passwords#update', as: :user_password, defaults: { format: 'html' } | |
# Confirmations | |
get 'auth/confirmation', to: 'auth/confirmations#show', as: :user_confirmation, defaults: { format: 'html' } | |
post 'auth/confirmation', to: 'auth/confirmations#create', defaults: { format: 'html' } | |
end | |
# API | |
# Namespaces.. | |
# Etc... | |
end |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment