diff options
author | Matija Čupić <matteeyah@gmail.com> | 2018-02-01 23:59:14 +0100 |
---|---|---|
committer | Matija Čupić <matteeyah@gmail.com> | 2018-02-01 23:59:14 +0100 |
commit | e6487168ea1e0016a76e3e62f156990dd4412679 (patch) | |
tree | a8be6c33c094af653f91656225cb6beb62ad6487 /app/models/project_auto_devops.rb | |
parent | a31539847fd431e18053d0ea5a007dc38134b3f2 (diff) | |
download | gitlab-ce-e6487168ea1e0016a76e3e62f156990dd4412679.tar.gz |
Read the AutoDevOps instance domain in ProjectAutoDevOps
Diffstat (limited to 'app/models/project_auto_devops.rb')
-rw-r--r-- | app/models/project_auto_devops.rb | 10 |
1 files changed, 8 insertions, 2 deletions
diff --git a/app/models/project_auto_devops.rb b/app/models/project_auto_devops.rb index 9a52edbff8e..f23310e854a 100644 --- a/app/models/project_auto_devops.rb +++ b/app/models/project_auto_devops.rb @@ -1,4 +1,6 @@ class ProjectAutoDevops < ActiveRecord::Base + include Gitlab::CurrentSettings + belongs_to :project scope :enabled, -> { where(enabled: true) } @@ -6,13 +8,17 @@ class ProjectAutoDevops < ActiveRecord::Base validates :domain, allow_blank: true, hostname: { allow_numeric_hostname: true } + def instance_domain + current_application_settings.auto_devops_domain + end + def has_domain? - domain.present? + domain.present? || instance_domain.present? end def variables variables = [] - variables << { key: 'AUTO_DEVOPS_DOMAIN', value: domain, public: true } if domain.present? + variables << { key: 'AUTO_DEVOPS_DOMAIN', value: domain || instance_domain, public: true } if has_domain? variables end end |