59 lines
1.5 KiB
Bash
Executable File
59 lines
1.5 KiB
Bash
Executable File
#!/bin/sh
|
|
# Copyright (c) 2013 VMware, Inc. All rights reserved.
|
|
#
|
|
# Licensed under the Apache License, Version 2.0 (the "License"); you may
|
|
# not use this file except in compliance with the License. You may obtain
|
|
# a copy of the License at
|
|
#
|
|
# http://www.apache.org/licenses/LICENSE-2.0
|
|
#
|
|
# Unless required by applicable law or agreed to in writing, software
|
|
# distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
|
|
# WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
|
|
# License for the specific language governing permissions and limitations
|
|
# under the License.
|
|
#
|
|
|
|
# Usage: run_api_server <port> <ssl_port>
|
|
# where:
|
|
# <port> : api server port, default: 8080
|
|
#
|
|
# <ssl_port> : api server SSL port, default: 8443
|
|
#
|
|
|
|
# Setup command line arguments
|
|
if [ "$1" = "" ] ; then
|
|
PORT=8080
|
|
else
|
|
PORT=$1
|
|
fi
|
|
if [ "$2" = "" ] ; then
|
|
SSLPORT=8443
|
|
else
|
|
SSLPORT=$2
|
|
fi
|
|
|
|
|
|
# TODO(pjb): Run from a build (rather than source) dir
|
|
SRCSCRIPT=`readlink -f $0`
|
|
SCRIPTDIR=`dirname $SRCSCRIPT`
|
|
ROOTDIR=`dirname $SCRIPTDIR`
|
|
PYSRCDIR=$ROOTDIR/src
|
|
SERVERDIR=$PYSRCDIR/server
|
|
POLICYDIR=$PYSRCDIR/policy
|
|
THIRDPARTYDIR=$ROOTDIR/thirdparty
|
|
|
|
export PYTHONPATH=$SRCDIR:$THIRDPARTYDIR
|
|
|
|
# Settings that typically don't change
|
|
INTERFACE=0.0.0.0
|
|
ADDR=$INTERFACE:$PORT
|
|
SSLADDR=$INTERFACE:$SSLPORT
|
|
|
|
|
|
# Start Node API server
|
|
# TODO(pjb): make this the web server not the compiler
|
|
ARGS="$@"
|
|
cd $SERVERDIR
|
|
python server.py $ARGS
|