Move if CONFIG.statistics_enabled
into the handler for the /metrics route
All checks were successful
Invidious CI / build (push) Successful in 5m9s
All checks were successful
Invidious CI / build (push) Successful in 5m9s
This commit is contained in:
parent
349f329190
commit
d693c2284a
2 changed files with 6 additions and 7 deletions
|
@ -29,6 +29,11 @@ module Invidious::Routes::API::V1::Misc
|
||||||
end
|
end
|
||||||
|
|
||||||
def self.metrics(env)
|
def self.metrics(env)
|
||||||
|
if !CONFIG.statistics_enabled
|
||||||
|
env.response.status_code = 204
|
||||||
|
return
|
||||||
|
end
|
||||||
|
|
||||||
env.response.content_type = "text/plain"
|
env.response.content_type = "text/plain"
|
||||||
|
|
||||||
return String.build do |str|
|
return String.build do |str|
|
||||||
|
|
|
@ -310,13 +310,7 @@ module Invidious::Routing
|
||||||
|
|
||||||
# Misc
|
# Misc
|
||||||
get "/api/v1/stats", {{namespace}}::Misc, :stats
|
get "/api/v1/stats", {{namespace}}::Misc, :stats
|
||||||
if CONFIG.statistics_enabled
|
get "/api/v1/metrics", {{namespace}}::Misc, :metrics
|
||||||
get "/api/v1/metrics", {{namespace}}::Misc, :metrics
|
|
||||||
else
|
|
||||||
get "/api/v1/metrics" do |env|
|
|
||||||
env.response.status_code = 204
|
|
||||||
end
|
|
||||||
end
|
|
||||||
get "/api/v1/playlists/:plid", {{namespace}}::Misc, :get_playlist
|
get "/api/v1/playlists/:plid", {{namespace}}::Misc, :get_playlist
|
||||||
get "/api/v1/auth/playlists/:plid", {{namespace}}::Misc, :get_playlist
|
get "/api/v1/auth/playlists/:plid", {{namespace}}::Misc, :get_playlist
|
||||||
get "/api/v1/mixes/:rdid", {{namespace}}::Misc, :mixes
|
get "/api/v1/mixes/:rdid", {{namespace}}::Misc, :mixes
|
||||||
|
|
Loading…
Add table
Reference in a new issue