summaryrefslogblamecommitdiffstats
path: root/load_common_and_env.sh
blob: 442c59c49496c7e96827ea69275832a14c8f245f (plain) (tree)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15














                                                                                            
#!/usr/bin/env bash
set -euo pipefail
trap 'if [ $? -ne 0 ]; then echo "FAILED ($?): Last command to run: $BASH_COMMAND"; fi' EXIT

# Load environment variables
if [ -f .env ]; then
    while IFS= read -r line || [[ -n "$line" ]]; do
        if [[ $line != \#* && $line != '' ]]; then
            export "$line"
        fi
    done < .env
else
    echo ".env file not found"
    exit 1
fi