Commit 62b7c3ba authored by Matija Čupić's avatar Matija Čupić

Short-circuit Project#auto_devops_variables

This makes Project#auto_devops_variables more performant by evaluating
the application settings only if necessary.
parent 6028f9ee
...@@ -1604,15 +1604,13 @@ class Project < ActiveRecord::Base ...@@ -1604,15 +1604,13 @@ class Project < ActiveRecord::Base
def auto_devops_variables def auto_devops_variables
return [] unless auto_devops_enabled? return [] unless auto_devops_enabled?
variables = [] auto_devops&.variables || if current_application_settings.auto_devops_domain.present?
[{ key: 'AUTO_DEVOPS_DOMAIN',
if current_application_settings.auto_devops_domain.present? value: current_application_settings.auto_devops_domain,
variables << { key: 'AUTO_DEVOPS_DOMAIN', public: true }]
value: current_application_settings.auto_devops_domain, else
public: true } []
end end
auto_devops&.variables || variables
end end
def append_or_update_attribute(name, value) def append_or_update_attribute(name, value)
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment