From 6b466d156932f0f16f2f8ae13a789f51ecece58b Mon Sep 17 00:00:00 2001 From: Christopher Baines Date: Tue, 3 Jul 2018 11:43:13 +0100 Subject: Use Plek for finding the GOV.UK Mini Environment Admin Rather than hardcoding localhost. --- .envrc | 2 ++ app/models/backends/terraform_aws/mini_environment_methods.rb | 2 +- app/models/backends/terraform_libvirt/mini_environment_methods.rb | 2 +- lib/terraform_working_directory.rb | 2 +- 4 files changed, 5 insertions(+), 3 deletions(-) diff --git a/.envrc b/.envrc index 2e58351..1f042c3 100644 --- a/.envrc +++ b/.envrc @@ -2,4 +2,6 @@ if [ -f .local.envrc ]; then source_env .local.envrc fi +export PLEK_SERVICE_MINI_ENVIRONMENT_ADMIN_URI="http://localhost:3000" + use guix --keep-failed --fallback -l guix.scm diff --git a/app/models/backends/terraform_aws/mini_environment_methods.rb b/app/models/backends/terraform_aws/mini_environment_methods.rb index 350df2a..bdb0ab4 100644 --- a/app/models/backends/terraform_aws/mini_environment_methods.rb +++ b/app/models/backends/terraform_aws/mini_environment_methods.rb @@ -104,7 +104,7 @@ module Backends::TerraformAws::MiniEnvironmentMethods slug: mini_environment.name.parameterize, start_command: mini_environment.backend_data['build_output'], backend_remote_state_address: ( - 'http://localhost:3000' + + Plek.new.external_url_for('mini-environment-admin') + Rails .application .routes diff --git a/app/models/backends/terraform_libvirt/mini_environment_methods.rb b/app/models/backends/terraform_libvirt/mini_environment_methods.rb index 64781df..4bf6adb 100644 --- a/app/models/backends/terraform_libvirt/mini_environment_methods.rb +++ b/app/models/backends/terraform_libvirt/mini_environment_methods.rb @@ -105,7 +105,7 @@ module Backends::TerraformLibvirt::MiniEnvironmentMethods host_name: "#{slug}.#{domain}", vm_image_and_system: mini_environment.backend_data['build_output'], backend_remote_state_address: ( - 'http://localhost:3000' + + Plek.new.external_url_for('mini-environment-admin') + Rails .application .routes diff --git a/lib/terraform_working_directory.rb b/lib/terraform_working_directory.rb index d8bbae3..6c2e25f 100644 --- a/lib/terraform_working_directory.rb +++ b/lib/terraform_working_directory.rb @@ -63,7 +63,7 @@ class TerraformWorkingDirectory def terraform_backend_address ( - 'http://localhost:3000' + + Plek.new.external_url_for('mini-environment-admin') + Rails .application .routes -- cgit v1.2.3