Created
November 6, 2019 07:50
-
-
Save jacops/dc6c1228be5c5ae361a3ce09bce614e4 to your computer and use it in GitHub Desktop.
Generate docker-compose environment block from .env like file
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
#!/usr/bin/env bash | |
FILE=$1 | |
for var in $(cat $FILE | grep "="); do | |
VAR_NAME="$(echo "$var" | cut -d "=" -f 1)" | |
VAR_VALUE="$(echo "$var" | cut -d "=" -f 2)" | |
echo "$VAR_NAME: \"\${$VAR_NAME:-$VAR_VALUE}\"" | |
done |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment