Skip to content

Commit

Permalink
Update script
Browse files Browse the repository at this point in the history
  • Loading branch information
kalaiyarasiganeshalingam committed Nov 23, 2024
1 parent da9771a commit f72afc0
Showing 1 changed file with 24 additions and 12 deletions.
36 changes: 24 additions & 12 deletions distribution/src/scripts/micro-integrator.sh
Original file line number Diff line number Diff line change
Expand Up @@ -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."
Expand Down Expand Up @@ -170,12 +176,18 @@ do
fi
echo "11111111111111111111111111 $c"
# Check if the argument starts with --env-file=
if [ "$c" = "--env-file=*" ]; then
echo "_____________________ env file __________"
# Extract the file path from the argument
case "$c" in
--env-file=*)
# Commands to execute if $c starts with '--env-file='
file_path="${c#--env-file=}"
export_env_file "$file_path"
fi
echo "Command starts with --env-file= $file_path"
;;
*)
# Commands to execute if $c does not start with '--env-file='
continue
;;
esac
done

if [ "$ARGUMENT" = "car" ]; then
Expand Down

0 comments on commit f72afc0

Please sign in to comment.