add aaf root ca certificates for osdf
[optf/osdf.git] / osdfapp.sh
index c54d59c..25e3c05 100755 (executable)
 # -------------------------------------------------------------------------
 #
 
-# Call osdf app after setting LD_LIBRARY_PATH for oracle client, postgres client, etc.
-
 cd $(dirname $0)
 
-# Environment variables below are for ORACLE_HOME and such things, and not needed for 1707 onwards
-# . ../dependencies/env.sh
-
-bash ../etc/make-certs.sh  # create the https certificates if they are not present
+# bash ../etc/make-certs.sh  # create the https certificates if they are not present
 
-set -e
+LOGS=logs
+mkdir -p $LOGS
 
-mkdir -p logs
+export OSDF_CONFIG_FILE=${1:-/opt/app/config/osdf_config.yaml}  # this file may be passed by invoker
+[ ! -e "$OSDF_CONFIG_FILE" ] && unset OSDF_CONFIG_FILE
 
-if [ ! -e "osdf-optim" ]; then
-(
-  mkdir tmp
-  cd tmp
-  tar xzf ../../dependencies/SNIROOptimizationPack.tgz
-  mv osdf ../osdf-optim
-  cd ../osdf-optim/pywheels
-  pip install docopt* jsonschema*
-)
-cp etc/run-case-local.sh osdf-optim/run/
+if [ -e /opt/app/ssl_cert/aaf_root_ca.cer ]; then
+    #assuming that this would be an ubuntu vm.
+    cp /opt/app/ssl_cert/aaf_root_ca.cer /usr/local/share/ca-certificates/aafcacert.crt
+    chmod 444 /usr/local/share/ca-certificates/aafcacert.crt
+    update-ca-certificates
 fi
 
-if [ $# -ge 1 ]; then
-   export SNIRO_MANAGER_CONFIG_FILE="$1"  # this file is passed by the DCAE controller
+if [ -e /etc/ssl/certs/aafcacert.pem ]; then
+    export REQUESTS_CA_BUNDLE=/etc/ssl/certs/ca-certificates.crt
+else
+    export REQUESTS_CA_BUNDLE=/opt/app/ssl_cert/aaf_root_ca.cer
 fi
 
-# export FLASK_APP=osdfapp.py
-
-# flask run
-python osdfapp.py # running the app 
+python osdfapp.py 2>$LOGS/err.log 1>$LOGS/out.log < /dev/null  # running the app