Enable test & dev modes for scripts
This commit is contained in:
15
server/ops
15
server/ops
@@ -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
|
||||
|
||||
Reference in New Issue
Block a user