update link to upper-constraints.txt
[optf/osdf.git] / osdfapp.sh
1 #!/bin/bash
2
3 # -------------------------------------------------------------------------
4 #   Copyright (c) 2015-2017 AT&T Intellectual Property
5 #
6 #   Licensed under the Apache License, Version 2.0 (the "License");
7 #   you may not use this file except in compliance with the License.
8 #   You may obtain a copy of the License at
9 #
10 #       http://www.apache.org/licenses/LICENSE-2.0
11 #
12 #   Unless required by applicable law or agreed to in writing, software
13 #   distributed under the License is distributed on an "AS IS" BASIS,
14 #   WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
15 #   See the License for the specific language governing permissions and
16 #   limitations under the License.
17 #
18 # -------------------------------------------------------------------------
19 #
20
21 usage() {
22         echo "Usage:"
23         echo "    $0 -h Display this help message."
24         echo "    $0 -c configfile_path(optional) -x app.py file"
25         exit 0
26 }
27
28 cd $(dirname $0)
29
30 # bash ../etc/make-certs.sh  # create the https certificates if they are not present
31
32 while getopts ":hc:x:" opt; do
33   case ${opt} in
34     h )
35       usage
36       ;;
37     c )
38       # process option configuration
39       export OSDF_CONFIG_FILE=$OPTARG
40       ;;
41     x )
42       # process executable file
43       export EXEC_FILE=$OPTARG
44       ;;
45     ? )
46       usage
47       ;;
48     : )
49       echo "Invalid Option: -$OPTARG requires an argument" 1>&2
50       exit 1
51      ;;
52   esac
53 done
54 shift $(( OPTIND - 1 ))
55
56 set -e
57
58 LOGS=logs
59 mkdir -p $LOGS
60
61 #if [ -e /opt/app/ssl_cert/aaf_root_ca.cer ]; then
62 #    #assuming that this would be an ubuntu vm.
63 #    cp /opt/app/ssl_cert/aaf_root_ca.cer /usr/local/share/ca-certificates/aafcacert.crt
64 #    chmod 444 /usr/local/share/ca-certificates/aafcacert.crt
65 #    update-ca-certificates
66 #fi
67
68 export REQUESTS_CA_BUNDLE=/etc/ssl/certs/ca-certificates.crt
69
70 if [ ! -z "$EXEC_FILE" ]
71 then
72         # flask run
73         echo "Running $EXEC_FILE"
74         python $EXEC_FILE # running the app
75 else
76     usage
77 fi