2021-11-08 07:12:07 -05:00
|
|
|
# frozen_string_literal: true
|
|
|
|
|
|
|
|
# Currently we register validator only for `dev` or `test` environment
|
2021-11-09 22:10:14 -05:00
|
|
|
if Gitlab.dev_or_test_env? || Gitlab::Utils.to_boolean(ENV['GITLAB_ENABLE_QUERY_ANALYZERS'], default: false)
|
|
|
|
Gitlab::Database::QueryAnalyzer.instance.hook!
|
2021-11-15 07:11:17 -05:00
|
|
|
Gitlab::Database::QueryAnalyzer.instance.all_analyzers.append(::Gitlab::Database::QueryAnalyzers::GitlabSchemasMetrics)
|
2021-11-10 07:10:12 -05:00
|
|
|
|
2021-11-17 19:13:32 -05:00
|
|
|
if Rails.env.test? || Gitlab::Utils.to_boolean(ENV['ENABLE_CROSS_DATABASE_MODIFICATION_DETECTION'], default: false)
|
|
|
|
Gitlab::Database::QueryAnalyzer.instance.all_analyzers.append(::Gitlab::Database::QueryAnalyzers::PreventCrossDatabaseModification)
|
|
|
|
end
|
|
|
|
|
2021-11-10 07:10:12 -05:00
|
|
|
Gitlab::Application.configure do |config|
|
|
|
|
config.middleware.use(Gitlab::Middleware::QueryAnalyzer)
|
|
|
|
end
|
2021-11-09 22:10:14 -05:00
|
|
|
end
|