Enable test & dev modes for scripts

This commit is contained in:
John Lyon-Smith
2018-04-21 10:32:12 -07:00
parent 60d51ea5a9
commit f9cee95614

View File

@@ -1,9 +1,21 @@
#!/bin/bash
if [[ "$1" == "--test" ]]; then
export NODE_APP_INSTANCE=test
shift
fi
if [[ "$1" == "--dev" ]]; then
export NODE_ENV=development
else
export NODE_ENV=production
fi
script_dir=$(dirname $0)
script="${script_dir}/dist/bin/${1}.js"
if [[ -z "$1" ]]; then
echo "usage: $(basename $0) <command>"
echo "usage: $(basename $0)[--test] [--dev] <command>"
echo ""
echo "Available commands are"
echo ""
@@ -13,7 +25,6 @@ fi
# For scripts that need config access
export NODE_CONFIG_DIR="${script_dir}/config"
export NODE_ENV=production
if [[ ! -e "${script}" ]]; then
echo error: Script ${script} does not exist