summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--app/services/create_deployment_service.rb16
1 files changed, 10 insertions, 6 deletions
diff --git a/app/services/create_deployment_service.rb b/app/services/create_deployment_service.rb
index 45f68391df8..63b85c3de7d 100644
--- a/app/services/create_deployment_service.rb
+++ b/app/services/create_deployment_service.rb
@@ -14,10 +14,8 @@ class CreateDeploymentService
return unless executable?
ActiveRecord::Base.transaction do
- if external_url = expanded_environment_url
- environment.external_url = external_url
- end
-
+ environment.external_url = expanded_environment_url if
+ expanded_environment_url
environment.fire_state_event(action)
return unless environment.save
@@ -53,8 +51,14 @@ class CreateDeploymentService
end
def expanded_environment_url
- ExpandVariables.expand(environment_options[:url], variables) if
- environment_options[:url]
+ return @expanded_environment_url if defined?(@expanded_environment_url)
+
+ @expanded_environment_url =
+ ExpandVariables.expand(environment_url, variables) if environment_url
+ end
+
+ def environment_url
+ environment_options[:url]
end
def on_stop