2022-01-06 12:31:30 -07:00
|
|
|
#! /bin/sh
|
|
|
|
|
2022-01-06 17:33:25 -07:00
|
|
|
# If you haven't set OUTDIR, set it to the default
|
|
|
|
: ${OUTDIR:=/incoming}
|
|
|
|
export OUTDIR
|
|
|
|
|
2022-01-09 20:23:05 -07:00
|
|
|
# This gets set to the directory containing what's currently running
|
|
|
|
: ${SCRIPTS:=$(dirname $0)}
|
|
|
|
|
2022-01-06 12:31:30 -07:00
|
|
|
log () {
|
|
|
|
printf "\033[36m=== [%s] \033[0m %s\n" "$0" "$*"
|
|
|
|
}
|
|
|
|
|
2022-01-09 16:26:12 -07:00
|
|
|
getenv () {
|
|
|
|
jq -r --arg key "$1" '.[$key]' < env.json
|
|
|
|
}
|
|
|
|
|
|
|
|
setenv () {
|
|
|
|
(cat env.json 2>/dev/null || echo '{}') \
|
|
|
|
| jq --arg key "$1" --arg val "$2" '.[$key] = $val' \
|
2022-01-09 20:39:22 -07:00
|
|
|
> env.json.new \
|
|
|
|
&& mv env.json.new env.json
|
2022-01-06 17:33:25 -07:00
|
|
|
}
|
|
|
|
|