From 40e74b507b0f1539c96758ec46525378dc80ee33 Mon Sep 17 00:00:00 2001 From: Kalaiyarasiganeshalingam Date: Sun, 24 Nov 2024 19:00:40 +0530 Subject: [PATCH] Update script --- .../ESB/serviceCatalog/micro-integrator.sh | 22 ++++++++++++------- 1 file changed, 14 insertions(+), 8 deletions(-) diff --git a/integration/mediation-tests/tests-other/src/test/resources/artifacts/ESB/serviceCatalog/micro-integrator.sh b/integration/mediation-tests/tests-other/src/test/resources/artifacts/ESB/serviceCatalog/micro-integrator.sh index 866b760b38..fe54ca0468 100755 --- a/integration/mediation-tests/tests-other/src/test/resources/artifacts/ESB/serviceCatalog/micro-integrator.sh +++ b/integration/mediation-tests/tests-other/src/test/resources/artifacts/ESB/serviceCatalog/micro-integrator.sh @@ -131,14 +131,20 @@ export_env_file() { # Read the .env file and export each variable to the environment while IFS='=' read -r key value; do - # Ignore lines starting with '#' (comments) or empty lines - if [ ! "$key" =~ ^# ] && [ "$key" != "" ]; then - # Trim surrounding whitespace from key and value - key=$(echo "$key" | xargs) - value=$(echo "$value" | xargs) - # Export the key-value pair to the environment - export "$key=$value" - fi + # Ignore lines starting with '#' (comments) or empty lines + case "$key" in + \#*|"") + # Skip comments or empty lines + continue + ;; + *) + # Trim surrounding whitespace from key and value + key=$(echo "$key" | xargs) + value=$(echo "$value" | xargs) + # Export the key-value pair to the environment + export "$key=$value" + ;; + esac done < "$file_path" echo "Environment variables loaded from $file_path."