forked from crowdAI/crowdai
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathconfig.ru
More file actions
21 lines (17 loc) · 680 Bytes
/
Copy pathconfig.ru
File metadata and controls
21 lines (17 loc) · 680 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
# This file is used by Rack-based servers to start the application.
require ::File.expand_path('../config/environment', __FILE__)
require 'prometheus/middleware/collector'
require 'prometheus/middleware/exporter'
rackapp = Rack::Builder.app do
use Prometheus::Middleware::Collector
map '/metrics' do
use Rack::Auth::Basic, 'Prometheus Metrics' do |username, password|
Rack::Utils.secure_compare(ENV['CROWDAI_API_KEY'], password)
end
use Rack::Deflater
use Prometheus::Middleware::Exporter, path: ''
run ->(_) { [500, { 'Content-Type' => 'text/html' }, ['crowdAI metrics endpoint is unreachable!']] }
end
run Rails.application
end
run rackapp