From 358f0cd5e8f3e23ca059c3fd5c1c5739faaeb425 Mon Sep 17 00:00:00 2001 From: Pjotr Prins Date: Mon, 3 Oct 2016 08:06:25 +0000 Subject: Handle JSON override files in startup script --- bin/genenetwork2 | 24 +++++++++++++++++------- 1 file changed, 17 insertions(+), 7 deletions(-) (limited to 'bin') 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 -- cgit v1.2.3