aboutsummaryrefslogtreecommitdiffstats
path: root/scripts/lib/env.sh
blob: e5985847b46a28fff629c4e87a3c6870d1d36471 (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
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"
}