tidy
This commit is contained in:
@ -1,5 +1,9 @@
|
||||
#!/bin/bash
|
||||
|
||||
# COMMON FUNCTIONS
|
||||
# JDE
|
||||
# 2025-04-25
|
||||
|
||||
# Print error message and exit with code 1
|
||||
# Usage: die "error message"
|
||||
die() {
|
||||
@ -13,7 +17,18 @@ die() {
|
||||
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
|
||||
@ -49,9 +64,7 @@ create_and_start_container() {
|
||||
local container_name="$2"
|
||||
|
||||
if _is_container_exists $container_name; then
|
||||
if _is_container_running $container_name; then
|
||||
return 0
|
||||
fi
|
||||
_is_container_running $container_name && return 0
|
||||
_start_container $container_name
|
||||
else
|
||||
grey_start
|
||||
@ -164,4 +177,4 @@ check_required_env_vars() {
|
||||
die "Required environment variable $var is not set in your service.env file"
|
||||
fi
|
||||
done
|
||||
}
|
||||
}
|
||||
|
Reference in New Issue
Block a user