feature/share-libs
rb 37 lines 1.39 KB
Raw
1 Rails.application.routes.draw do
2 require 'sidekiq/web'
3 require 'api_constraints'
4
5 # TODO: Authenticated
6 mount Tolk::Engine => '/sloth', :as => 'tolk'
7 mount Sidekiq::Web => '/c2lkZWtpcQ=='
8 mount ActionCable.server => '/cable'
9 mount Split::Dashboard, at: '/hatch'
10 Split::Dashboard.use Rack::Auth::Basic do |username, password|
11 # Protect against timing attacks:
12 # - Use & (do not use &&) so that it doesn't short circuit.
13 # - Use digests to stop length information leaking
14 ActiveSupport::SecurityUtils.secure_compare(::Digest::SHA256.hexdigest(username),
15 ::Digest::SHA256.hexdigest(ENV['SPLIT_USERNAME'])) &
16 ActiveSupport::SecurityUtils.secure_compare(::Digest::SHA256.hexdigest(password),
17 ::Digest::SHA256.hexdigest(ENV['SPLIT_PASSWORD']))
18 end
19
20 # Use a single User model for both ActiveAdmin and application frontend.
21 ActiveAdmin.routes(self)
22
23 devise_for :users, controllers: {
24 sessions: 'sessions',
25 omniauth_callbacks: 'users/omniauth_callbacks',
26 confirmations: 'confirmations',
27 passwords: 'passwords'
28 }
29
30 delete 'logout', to: 'sessions#destroy'
31 get 'sitemap', to: 'about#sitemap'
32 match '/404', to: 'errors#not_found', via: :all
33 match '/500', to: 'errors#internal_server_error', via: :all
34
35 draw(:api)
36 draw(:localized)
37 end