From 3c546acf78408087b5062be67ae6b05650e0f27e Mon Sep 17 00:00:00 2001 From: Sean McGivern Date: Tue, 9 May 2017 20:40:19 +0100 Subject: Allow disabling usage ping in `gitlab.yml` Setting `usage_ping_enabled` to false in `gitlab.yml`: 1. Disables the usage ping, regardless of the value stored in the database. 2. Prevents the usage ping from being enabled through the admin panel. It can only be enabled by either removing the line from `gitlab.yml` and configuring through the admin panel, or setting it to true in `gitlab.yml`. --- app/models/application_setting.rb | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) (limited to 'app/models/application_setting.rb') diff --git a/app/models/application_setting.rb b/app/models/application_setting.rb index 54f01f8637e..043f57241a3 100644 --- a/app/models/application_setting.rb +++ b/app/models/application_setting.rb @@ -246,7 +246,7 @@ class ApplicationSetting < ActiveRecord::Base two_factor_grace_period: 48, user_default_external: false, polling_interval_multiplier: 1, - usage_ping_enabled: true + usage_ping_enabled: Settings.gitlab['usage_ping_enabled'] } end @@ -349,6 +349,14 @@ class ApplicationSetting < ActiveRecord::Base sidekiq_throttling_enabled end + def usage_ping_can_be_configured? + Settings.gitlab.usage_ping_enabled + end + + def usage_ping_enabled + usage_ping_can_be_configured? && super + end + private def ensure_uuid! -- cgit v1.2.1