forked from CredentialEngine/CredentialRegistry
-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathconfig.ru
More file actions
40 lines (31 loc) · 1.04 KB
/
config.ru
File metadata and controls
40 lines (31 loc) · 1.04 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
require File.expand_path('config/environment', __dir__)
require 'rack/cors'
require 'sidekiq/web'
use Rack::Session::Cookie, key: 'rack.session',
path: '/',
secret: ENV.fetch('SECRET_KEY_BASE')
use Rack::TryStatic, root: 'public', urls: %w[/], try: %w[.html index.html]
use Rack::Cors do
allow do
origins '*'
resource '*', headers: :any, methods: :get
end
end
use Airbrake::Rack::Middleware if ENV['AIRBRAKE_PROJECT_ID'].present?
map '/sidekiq' do
unless MR.env == 'development'
use Rack::Auth::Basic, 'Protected Area' do |username, password|
username_matches = Rack::Utils.secure_compare(
Digest::SHA256.hexdigest(username),
Digest::SHA256.hexdigest(ENV.fetch('SIDEKIQ_USERNAME', nil))
)
password_matches = Rack::Utils.secure_compare(
Digest::SHA256.hexdigest(password),
Digest::SHA256.hexdigest(ENV.fetch('SIDEKIQ_PASSWORD', nil))
)
username_matches && password_matches
end
end
run Sidekiq::Web
end
run API::Base