From e299dbe30c8779229709ea791c2c70bffd00fcb5 Mon Sep 17 00:00:00 2001 From: Elliot Crosby-McCullough Date: Fri, 22 Feb 2019 14:08:03 +0000 Subject: [PATCH] Allow other startup options for staging etc --- startup.sh | 40 ++++++++++++++++++++++++---------------- 1 file changed, 24 insertions(+), 16 deletions(-) diff --git a/startup.sh b/startup.sh index 10c628858..4c98ea7de 100755 --- a/startup.sh +++ b/startup.sh @@ -2,22 +2,30 @@ bundle install +function set_env() { + export GOVUK_APP_DOMAIN=www.$1 + export GOVUK_WEBSITE_ROOT=https://www.$1 + export PLEK_SERVICE_CONTENT_STORE_URI=${PLEK_SERVICE_CONTENT_STORE_URI-https://www.$1/api} + export PLEK_SERVICE_RUMMAGER_URI=${PLEK_SERVICE_RUMMAGER_URI-https://www.$1/api} + export PLEK_SERVICE_SEARCH_URI=${PLEK_SERVICE_SEARCH_URI-https://www.$1/api} +} + if [[ $1 == "--live" ]] ; then - GOVUK_APP_DOMAIN=www.gov.uk \ - GOVUK_WEBSITE_ROOT=https://www.gov.uk \ - PLEK_SERVICE_CONTENT_STORE_URI=${PLEK_SERVICE_CONTENT_STORE_URI-https://www.gov.uk/api} \ - PLEK_SERVICE_STATIC_URI=${PLEK_SERVICE_STATIC_URI-assets.publishing.service.gov.uk} \ - PLEK_SERVICE_RUMMAGER_URI=${PLEK_SERVICE_RUMMAGER_URI-https://www.gov.uk/api} \ - PLEK_SERVICE_SEARCH_URI=${PLEK_SERVICE_SEARCH_URI-https://www.gov.uk/api} \ - bundle exec rails s -p 3090 + set_env "gov.uk" + export PLEK_SERVICE_STATIC_URI=${PLEK_SERVICE_STATIC_URI-assets.publishing.service.gov.uk} +elif [[ $1 == "--staging" ]] ; then + set_env "staging.publishing.service.gov.uk" + export PLEK_SERVICE_STATIC_URI=${PLEK_SERVICE_STATIC_URI-assets.staging.publishing.service.gov.uk} +elif [[ $1 == "--integration" ]] ; then + set_env "integration.publishing.service.gov.uk" + export PLEK_SERVICE_STATIC_URI=${PLEK_SERVICE_STATIC_URI-assets.integration.publishing.service.gov.uk} elif [[ $1 == "--dummy" ]] ; then - GOVUK_APP_DOMAIN=www.gov.uk \ - GOVUK_WEBSITE_ROOT=https://www.gov.uk \ - PLEK_SERVICE_CONTENT_STORE_URI=${PLEK_SERVICE_CONTENT_STORE_URI-https://govuk-content-store-examples.herokuapp.com/api} \ - PLEK_SERVICE_STATIC_URI=${PLEK_SERVICE_STATIC_URI-assets.publishing.service.gov.uk} \ - PLEK_SERVICE_RUMMAGER_URI=${PLEK_SERVICE_RUMMAGER_URI-https://www.gov.uk/api} \ - PLEK_SERVICE_SEARCH_URI=${PLEK_SERVICE_SEARCH_URI-https://www.gov.uk/api} \ - bundle exec rails s -p 3090 -else - bundle exec rails s -p 3090 + export GOVUK_APP_DOMAIN=www.gov.uk + export GOVUK_WEBSITE_ROOT=https://www.gov.uk + export PLEK_SERVICE_CONTENT_STORE_URI=${PLEK_SERVICE_CONTENT_STORE_URI-https://govuk-content-store-examples.herokuapp.com/api} + export PLEK_SERVICE_STATIC_URI=${PLEK_SERVICE_STATIC_URI-assets.publishing.service.gov.uk} + export PLEK_SERVICE_RUMMAGER_URI=${PLEK_SERVICE_RUMMAGER_URI-https://www.gov.uk/api} + export PLEK_SERVICE_SEARCH_URI=${PLEK_SERVICE_SEARCH_URI-https://www.gov.uk/api} fi + +bundle exec rails s -p 3090