Skip to content

Commit

Permalink
Update script
Browse files Browse the repository at this point in the history
  • Loading branch information
kalaiyarasiganeshalingam committed Nov 24, 2024
1 parent e96c0cb commit 9a3091c
Show file tree
Hide file tree
Showing 14 changed files with 280 additions and 146 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -149,14 +149,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 @@ -186,11 +192,15 @@ do
args="$args $c"
fi
# Check if the argument starts with --env-file=
if [ "$c" == --env-file=* ]; then
# Extract the file path from the argument
case "$c" in
--env-file=*)
file_path="${c#--env-file=}"
export_env_file "$file_path"
fi
;;
*)
continue
;;
esac
done

if [ "$CMD" = "--debug" ]; then
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -149,14 +149,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 @@ -186,11 +192,15 @@ do
args="$args $c"
fi
# Check if the argument starts with --env-file=
if [ "$c" == --env-file=* ]; then
# Extract the file path from the argument
case "$c" in
--env-file=*)
file_path="${c#--env-file=}"
export_env_file "$file_path"
fi
;;
*)
continue
;;
esac
done

if [ "$CMD" = "--debug" ]; then
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -149,14 +149,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 @@ -186,11 +192,15 @@ do
args="$args $c"
fi
# Check if the argument starts with --env-file=
if [ "$c" == --env-file=* ]; then
# Extract the file path from the argument
case "$c" in
--env-file=*)
file_path="${c#--env-file=}"
export_env_file "$file_path"
fi
;;
*)
continue
;;
esac
done

if [ "$CMD" = "--debug" ]; then
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -166,11 +166,15 @@ do
args="$args $c"
fi
# Check if the argument starts with --env-file=
if [ "$c" == --env-file=* ]; then
# Extract the file path from the argument
case "$c" in
--env-file=*)
file_path="${c#--env-file=}"
export_env_file "$file_path"
fi
;;
*)
continue
;;
esac
done

if [ "$CMD" = "--debug" ]; then
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -149,14 +149,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 @@ -186,11 +192,15 @@ do
args="$args $c"
fi
# Check if the argument starts with --env-file=
if [ "$c" == --env-file=* ]; then
# Extract the file path from the argument
case "$c" in
--env-file=*)
file_path="${c#--env-file=}"
export_env_file "$file_path"
fi
;;
*)
continue
;;
esac
done

if [ "$CMD" = "--debug" ]; then
Expand Down
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 @@ -166,11 +172,15 @@ do
args="$args $c"
fi
# Check if the argument starts with --env-file=
if [ "$c" == --env-file=* ]; then
# Extract the file path from the argument
case "$c" in
--env-file=*)
file_path="${c#--env-file=}"
export_env_file "$file_path"
fi
;;
*)
continue
;;
esac
done

if [ "$CMD" = "--debug" ]; then
Expand Down
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 @@ -169,11 +175,15 @@ do
args="$args $c"
fi
# Check if the argument starts with --env-file=
if [ "$c" == --env-file=* ]; then
# Extract the file path from the argument
case "$c" in
--env-file=*)
file_path="${c#--env-file=}"
export_env_file "$file_path"
fi
;;
*)
continue
;;
esac
done

if [ "$ARGUMENT" = "car" ]; then
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -148,14 +148,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 @@ -185,11 +191,15 @@ do
args="$args $c"
fi
# Check if the argument starts with --env-file=
if [ "$c" == --env-file=* ]; then
# Extract the file path from the argument
case "$c" in
--env-file=*)
file_path="${c#--env-file=}"
export_env_file "$file_path"
fi
;;
*)
continue
;;
esac
done

if [ "$CMD" = "--debug" ]; then
Expand Down
Loading

0 comments on commit 9a3091c

Please sign in to comment.