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
def auto_devops_variables
return [] unless auto_devops_enabled?
variables = []
if current_application_settings.auto_devops_domain.present?
variables << { key: 'AUTO_DEVOPS_DOMAIN',
value: current_application_settings.auto_devops_domain,
public: true }
end
auto_devops&.variables || variables
auto_devops&.variables || if current_application_settings.auto_devops_domain.present?
[{ key: 'AUTO_DEVOPS_DOMAIN',
value: current_application_settings.auto_devops_domain,
public: true }]
else
[]
end
end
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