diff options
Diffstat (limited to 'app/services/deployments/update_environment_service.rb')
-rw-r--r-- | app/services/deployments/update_environment_service.rb | 21 |
1 files changed, 17 insertions, 4 deletions
diff --git a/app/services/deployments/update_environment_service.rb b/app/services/deployments/update_environment_service.rb index e9c2f41f626..98fedb9f699 100644 --- a/app/services/deployments/update_environment_service.rb +++ b/app/services/deployments/update_environment_service.rb @@ -25,11 +25,10 @@ module Deployments def update_environment(deployment) ActiveRecord::Base.transaction do - if (url = expanded_environment_url) - environment.external_url = url - end - + # Renew attributes at update + renew_external_url renew_auto_stop_in + renew_deployment_tier environment.fire_state_event(action) if environment.save && !environment.stopped? @@ -56,11 +55,25 @@ module Deployments environment_options[:action] || 'start' end + def renew_external_url + if (url = expanded_environment_url) + environment.external_url = url + end + end + def renew_auto_stop_in return unless deployable environment.auto_stop_in = deployable.environment_auto_stop_in end + + def renew_deployment_tier + return unless deployable + + if (tier = deployable.environment_deployment_tier) + environment.tier = tier + end + end end end |