Big Refactor
This commit is contained in:
@ -14,41 +14,6 @@ die() {
|
||||
exit 1
|
||||
}
|
||||
|
||||
# Load environment variables from .env file
|
||||
# Usage: load_env [path_to_env_file]
|
||||
# If no path is provided, looks for .env in the same directory as the script
|
||||
load_env() {
|
||||
local script_dir="$(dirname "${BASH_SOURCE[0]}")"
|
||||
local env_file
|
||||
|
||||
# first load basic.env for the template defaults
|
||||
if [ -f "$script_dir/_basic.env" ]; then
|
||||
set -a
|
||||
source "$script_dir/_basic.env"
|
||||
set +a
|
||||
else
|
||||
echo "Warning: _basic.env file not found at $script_dir/_basic.env. Broken template?"
|
||||
return 1
|
||||
fi
|
||||
|
||||
# now load the server specific env file
|
||||
if [ -z "$1" ]; then
|
||||
echo "Usage: $0 [path_to_env_file]"
|
||||
return 1
|
||||
fi
|
||||
|
||||
env_file="$1/service.env"
|
||||
|
||||
if [ ! -f "$env_file" ]; then
|
||||
echo "Warning: service.env file not found at $1"
|
||||
return 1
|
||||
fi
|
||||
|
||||
set -a
|
||||
source "$env_file"
|
||||
set +a
|
||||
}
|
||||
|
||||
grey_start() {
|
||||
echo -e -n "\033[90m"
|
||||
}
|
||||
|
Reference in New Issue
Block a user