Created
May 18, 2018 20:52
-
-
Save pateketrueke/7f6354639765c38cb8355237b8b5fcb0 to your computer and use it in GitHub Desktop.
Extract ENV vars from JSON files
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/bash | |
set -eu | |
echo "$( tr '\n' ' ' < vars.json | jq -r 'keys[] as $k | "export \($k)=\"\(.[$k])\""' )" | |
# usage: | |
# ./env.sh > .env | |
#. source .env | |
# echo "$SOME_ENV_VALUE" |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment