summaryrefslogtreecommitdiff
path: root/app/models/application_setting.rb
diff options
context:
space:
mode:
Diffstat (limited to 'app/models/application_setting.rb')
-rw-r--r--app/models/application_setting.rb8
1 files changed, 8 insertions, 0 deletions
diff --git a/app/models/application_setting.rb b/app/models/application_setting.rb
index b47e1142cca..4028d711fd1 100644
--- a/app/models/application_setting.rb
+++ b/app/models/application_setting.rb
@@ -99,6 +99,10 @@ class ApplicationSetting < ApplicationRecord
presence: true,
if: :plantuml_enabled
+ validates :sourcegraph_url,
+ presence: true,
+ if: :sourcegraph_enabled
+
validates :snowplow_collector_hostname,
presence: true,
hostname: true,
@@ -343,6 +347,10 @@ class ApplicationSetting < ApplicationRecord
end
after_commit :expire_performance_bar_allowed_user_ids_cache, if: -> { previous_changes.key?('performance_bar_allowed_group_id') }
+ def sourcegraph_url_is_com?
+ !!(sourcegraph_url =~ /\Ahttps:\/\/(www\.)?sourcegraph\.com/)
+ end
+
def self.create_from_defaults
transaction(requires_new: true) do
super