aboutsummaryrefslogtreecommitdiffstats
path: root/scripts/lib/env.sh
diff options
context:
space:
mode:
Diffstat (limited to 'scripts/lib/env.sh')
-rw-r--r--scripts/lib/env.sh20
1 files changed, 20 insertions, 0 deletions
diff --git a/scripts/lib/env.sh b/scripts/lib/env.sh
new file mode 100644
index 0000000..e598584
--- /dev/null
+++ b/scripts/lib/env.sh
@@ -0,0 +1,20 @@
+# shellcheck shell=bash
+[[ -n "${BOLT_ENV_LOADED:-}" ]] && return
+readonly BOLT_ENV_LOADED=1
+
+source "$(dirname "${BASH_SOURCE[0]}")/log.sh"
+
+load_env_file() {
+ local -r env_file="$1"
+ if [[ ! -f "$env_file" ]]; then
+ log_error "Environment file not found: $env_file"
+ return 1
+ fi
+
+ set -a
+ # shellcheck disable=SC1090
+ source "$env_file"
+ set +a
+
+ log_info "Loaded environment from $env_file"
+}