From f9cee95614fb62e31c746e6d16a4c0672f1c2cb1 Mon Sep 17 00:00:00 2001 From: John Lyon-Smith Date: Sat, 21 Apr 2018 10:32:12 -0700 Subject: [PATCH] Enable test & dev modes for scripts --- server/ops | 15 +++++++++++++-- 1 file changed, 13 insertions(+), 2 deletions(-) diff --git a/server/ops b/server/ops index 2bba30e..29071c2 100755 --- a/server/ops +++ b/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) " + echo "usage: $(basename $0)[--test] [--dev] " 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