DEV: Add optional ENV variables for MiniProfiler snapshots transporter (#10985)

This commit is contained in:
Osama Sayegh 2020-10-21 19:37:28 +03:00 committed by GitHub
parent 6811902a70
commit a04c300495
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
3 changed files with 16 additions and 1 deletions

View File

@ -305,7 +305,10 @@ class ApplicationController < ActionController::Base
def set_mp_snapshot_fields
if defined?(Rack::MiniProfiler)
Rack::MiniProfiler.add_snapshot_custom_field("application version", Discourse.git_version)
Rack::MiniProfiler.add_snapshot_custom_field("Application version", Discourse.git_version)
if Rack::MiniProfiler.snapshots_transporter?
Rack::MiniProfiler.add_snapshot_custom_field("Site", Discourse.current_hostname)
end
end
end

View File

@ -99,6 +99,16 @@ load_mini_profiler = true
# Default is never
mini_profiler_snapshots_period = 0
# specify the URL of the destination that MiniProfiler should ship snapshots to
# mini_profiler_snapshots_transport_auth_key is required as well
mini_profiler_snapshots_transport_url =
# authorization key that will be included as a header in requests made by the
# snapshots transporter to the URL specified above. The destination should
# know this key and only accept requests that have this key in the
# `Mini-Profiler-Transport-Auth` header.
mini_profiler_snapshots_transport_auth_key =
# recommended, cdn used to access assets
cdn_url =

View File

@ -25,6 +25,8 @@ if defined?(Rack::MiniProfiler) && defined?(Rack::MiniProfiler::Config)
)
Rack::MiniProfiler.config.snapshot_every_n_requests = GlobalSetting.mini_profiler_snapshots_period
Rack::MiniProfiler.config.snapshots_transport_destination_url = GlobalSetting.mini_profiler_snapshots_transport_url
Rack::MiniProfiler.config.snapshots_transport_auth_key = GlobalSetting.mini_profiler_snapshots_transport_auth_key
Rack::MiniProfiler.config.skip_paths = [
/^\/message-bus/,
/^\/extra-locales/,