class GDS::Metrics::Auth
Attributes
app[RW]
Public Class Methods
new(app)
click to toggle source
# File lib/gds_metrics/auth.rb, line 6 def initialize(app) self.app = app end
Public Instance Methods
call(env)
click to toggle source
# File lib/gds_metrics/auth.rb, line 10 def call(env) return app.call(env) unless metrics_path?(env) return app.call(env) unless config.auth_enabled? return app.call(env) if authorized?(env) unauthorized end
Private Instance Methods
config()
click to toggle source
# File lib/gds_metrics/auth.rb, line 32 def config Config.instance end
metrics_path?(env)
click to toggle source
# File lib/gds_metrics/auth.rb, line 20 def metrics_path?(env) path = env.fetch("PATH_INFO") path == config.prometheus_metrics_path end