Created
September 24, 2019 16:19
-
-
Save james2doyle/da6858c8582c2d1b85d474dddf17fda3 to your computer and use it in GitHub Desktop.
This is a trick to load a .ENV file into the session and then evaluate a template file, replacing the variables in it
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
# read the .env file into the current env | |
source <(sed -E -n 's/[^#]+/export &/ p' .env) | |
# we need to escape the $ as ${DOLLAR} in the template, | |
# so now we can replace it correctly | |
sudo cat stub.conf.template | DOLLAR='$' envsubst > "${NEW_TEMPLATE_NAME}.conf" |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment