-
Notifications
You must be signed in to change notification settings - Fork 3
Expand file tree
/
Copy pathenv.sh
More file actions
29 lines (24 loc) · 819 Bytes
/
env.sh
File metadata and controls
29 lines (24 loc) · 819 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
#!/usr/bin/env bash
#
# Set confidential environment variables.
# This should be sourced, not executed.
# Set the variable $project_root to be the directory containing this script.
project_root=$( dirname "${BASH_SOURCE[0]}" )
dotenv_bin="$project_root/Python/.venv/bin/dotenv"
env_secret="$project_root/.env.secret"
if [[ ! -f "$env_secret" ]]; then
echo "Error: $env_secret not found." >&2
exit 1
fi
# Print variable names (not values)
if [[ "${SHOW_SECRET_VARS:-}" == "1" ]]; then
"$dotenv_bin" -f "$env_secret" list --format=shell | while IFS= read -r line; do
# Only process non-empty lines that contain '='
varname="${line%%=*}"
echo "$varname"
done
fi
eval $( "$dotenv_bin" -f "$env_secret" list --format=export )
unset dotenv_bin
unset project_root
unset env_secret