Enable test & dev modes for scripts
This commit is contained in:
15
server/ops
15
server/ops
@@ -1,9 +1,21 @@
|
|||||||
#!/bin/bash
|
#!/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_dir=$(dirname $0)
|
||||||
script="${script_dir}/dist/bin/${1}.js"
|
script="${script_dir}/dist/bin/${1}.js"
|
||||||
|
|
||||||
if [[ -z "$1" ]]; then
|
if [[ -z "$1" ]]; then
|
||||||
echo "usage: $(basename $0) <command>"
|
echo "usage: $(basename $0)[--test] [--dev] <command>"
|
||||||
echo ""
|
echo ""
|
||||||
echo "Available commands are"
|
echo "Available commands are"
|
||||||
echo ""
|
echo ""
|
||||||
@@ -13,7 +25,6 @@ fi
|
|||||||
|
|
||||||
# For scripts that need config access
|
# For scripts that need config access
|
||||||
export NODE_CONFIG_DIR="${script_dir}/config"
|
export NODE_CONFIG_DIR="${script_dir}/config"
|
||||||
export NODE_ENV=production
|
|
||||||
|
|
||||||
if [[ ! -e "${script}" ]]; then
|
if [[ ! -e "${script}" ]]; then
|
||||||
echo error: Script ${script} does not exist
|
echo error: Script ${script} does not exist
|
||||||
|
|||||||
Reference in New Issue
Block a user