From 186ffd2cd20c019c4b444a041a3f664bacc6181d Mon Sep 17 00:00:00 2001 From: Alejandro Sanchez Date: Fri, 28 Feb 2020 11:52:40 -0800 Subject: [PATCH] Replace all dashes with underscores in bash script Fixes string replacement for names with multiple slashes, e.g. "API-SERVICE-NAME" See https://stackoverflow.com/questions/5928156/replace-one-character-with-another-in-bash Signed-off-by: Alejandro Sanchez --- tob-web/openshift/templates/nginx-runtime/s2i/bin/run | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tob-web/openshift/templates/nginx-runtime/s2i/bin/run b/tob-web/openshift/templates/nginx-runtime/s2i/bin/run index 1c089d0ed..d566d222e 100644 --- a/tob-web/openshift/templates/nginx-runtime/s2i/bin/run +++ b/tob-web/openshift/templates/nginx-runtime/s2i/bin/run @@ -104,7 +104,7 @@ getApiUrl (){ # Results in API_URL=https://dev-demo-api.orgbook.gov.bc.ca/api/v2/ # ================================================================================ if [ ! -z "${API_SERVICE_NAME}" ]; then - _SERVICE_NAME="$(tr '[:lower:]' '[:upper:]' <<< ${API_SERVICE_NAME/-/_})" + _SERVICE_NAME="$(tr '[:lower:]' '[:upper:]' <<< ${API_SERVICE_NAME//-/_})" _SERVICE_HOST_NAME=${_SERVICE_NAME}_SERVICE_HOST _SERVICE_PORT_NAME=${_SERVICE_NAME}_SERVICE_PORT