Created
July 26, 2020 02:12
-
-
Save bhubr/82684767d94c9325469ccda9c1956d08 to your computer and use it in GitHub Desktop.
Import .env file to Dokku
This file contains hidden or 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 | |
# Check number of args | |
# https://stackoverflow.com/q/18568706/ | |
if [ "$#" -ne 2 ]; then | |
echo "Usage: import-env.sh <env-file> <dokku-app>" | |
fi | |
ENV_FILE=$1 | |
DOKKU_APP=$2 | |
# https://www.tutorialkart.com/bash-shell-scripting/bash-split-string/ | |
IFS='=' | |
# https://stackoverflow.com/q/19331497/ | |
cat $ENV_FILE | while read line; do | |
read -ra ADDR <<< "$line" | |
dokku config:set --no-restart $DOKKU_APP "${ADDR[0]}"="${ADDR[1]}" | |
done |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment