Last active
June 6, 2022 00:52
-
-
Save rjocoleman/6228ce914a51a297ec8321480b96490b to your computer and use it in GitHub Desktop.
Set Dokku environment variables in bulk from a .env file. assumed to run from the application directory
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash | |
set -euo pipefail | |
IFS=$'\n\t' | |
env_file=${1:-} | |
if [[ -z "$env_file" ]]; then | |
echo -e "usage: $0 env_file" | |
exit 1 | |
fi | |
while read -r env; do | |
[[ -n "${env}" ]] || continue # skip blank lines | |
[[ "${env}" != \#* ]] || continue # skip commented lines | |
dokku config:set --no-restart "${env}" < /dev/null | |
done < "${env_file}" |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment