Skip to content

Instantly share code, notes, and snippets.

@rjocoleman
Last active June 6, 2022 00:52
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save rjocoleman/6228ce914a51a297ec8321480b96490b to your computer and use it in GitHub Desktop.
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
#!/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