Last active
June 7, 2023 13:04
-
-
Save kunokdev/e67888303cd8f65b3e235cba0f2cad20 to your computer and use it in GitHub Desktop.
Reads each line of .env file, uses env var value is set, otherwise default value from .env file itself
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/sh | |
# line endings must be \n, not \r\n ! | |
echo "window._env_ = {" > ./env-config.js | |
awk -F '=' '{ print $1 ": \"" (ENVIRON[$1] ? ENVIRON[$1] : $2) "\"," }' ./.env >> ./env-config.js | |
echo "}" >> ./env-config.js |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment