diff options
author | Pjotr Prins | 2016-10-03 08:06:25 +0000 |
---|---|---|
committer | Pjotr Prins | 2016-10-03 08:06:25 +0000 |
commit | 358f0cd5e8f3e23ca059c3fd5c1c5739faaeb425 (patch) | |
tree | d469c4578b13a5aefbade426990fcb4a4b4c8589 | |
parent | e7d706004afc73210f44a3c61e840dfe0977e9f0 (diff) | |
download | genenetwork2-358f0cd5e8f3e23ca059c3fd5c1c5739faaeb425.tar.gz |
Handle JSON override files in startup script
-rwxr-xr-x | bin/genenetwork2 | 24 |
1 files changed, 17 insertions, 7 deletions
diff --git a/bin/genenetwork2 b/bin/genenetwork2 index d926d6a1..872e9326 100755 --- a/bin/genenetwork2 +++ b/bin/genenetwork2 @@ -1,14 +1,19 @@ #! /bin/bash # -# This will run the GN2 server (with default settings if none supplied). Pass in -# your own settings file, e.g. +# This will run the GN2 server (with default settings if none +# supplied). Pass in your own settings file, e.g. # # ./bin/genenetwork2 ~/my_settings.py # +# But better is to retain the defaults and override them with +# JSON file (see the deploy docs). +# +# ./bin/genenetwork2 ~/my_overrides.json +# # To run a maintenance script with settings (instead of the webserver) add that with # a -c switch, e.g. # -# ./bin/genenetwork2 ~/my_settings.py -c ./wqflask/maintenance/gen_select_dataset.py +# ./bin/genenetwork2 ~/my_overrides.json -c ./wqflask/maintenance/gen_select_dataset.py # # Environment settings can be used to preconfigure as well as a # settings.py file. @@ -23,10 +28,11 @@ if [ -d $GN2_GUIX_PATH ]; then fi echo $GN2_BASE_PATH -# Handle settings parameter +# Handle settings parameter (can be .py or .json) settings=$1 -if [ -z $settings ]; then - # get default +ext="${settings##*.}" +if [ -z "$settings" -o "$ext" = "json" -o "$ext" = "JSON" ]; then + overrides=$settings settings=$GN2_BASE_PATH/etc/default_settings.py else shift @@ -35,7 +41,11 @@ if [ ! -e $settings ]; then echo "ERROR: can not locate settings file - pass it in the command line" exit 1 fi -export WQFLASK_SETTINGS=$settings +export WQFLASK_SETTINGS=$settings # Python +export WQFLASK_OVERRIDES=$overrides # JSON + +echo WQFLASK_SETTINGS=$settings +echo WQFLASK_OVERRIDES=$overrides # We may change this one: export PYTHONPATH=$GN2_BASE_PATH/wqflask:$PYTHONPATH |