Skip to content

Commit

Permalink
midasserver: allow setting custom port to listen to
Browse files Browse the repository at this point in the history
  • Loading branch information
RayPlante committed Feb 23, 2024
1 parent 582bb39 commit 05e793a
Showing 1 changed file with 12 additions and 2 deletions.
14 changes: 12 additions & 2 deletions docker/midasserver/run.sh
Original file line number Diff line number Diff line change
Expand Up @@ -49,6 +49,8 @@ ARGUMENTS
-M, --use-mongodb Use a MongoDB backend; DIR must also be provided.
If not set, a file-based database (using JSON
files) will be used, stored under DIR/dbfiles.
-p, --port NUM The port that the service should listen to
(default: 9091)
-h, --help Print this text to the terminal and then exit
EOF
Expand All @@ -68,6 +70,7 @@ function build_server_image {
$dockerdir/dockbuild.sh -d midasserver # > log
}

PORT=9091
DOPYBUILD=
DODOCKBUILD=
CONFIGFILE=
Expand All @@ -89,6 +92,13 @@ while [ "$1" != "" ]; do
--config-file=*)
CONFIGFILE=`echo $1 | sed -e 's/[^=]*=//'`
;;
-p)
shift
PORT=$1
;;
--port=*)
PORT=`echo $1 | sed -e 's/[^=]*=//'`
;;
-M|--use-mongo)
DBTYPE="mongo"
;;
Expand Down Expand Up @@ -217,7 +227,7 @@ if [ "$ACTION" = "stop" ]; then
stop_server || true
$STOP_MONGO
else
echo '+' docker run $ENVOPTS $VOLOPTS $NETOPTS -p 127.0.0.1:9091:9091/tcp --rm --name=$CONTAINER_NAME $PACKAGE_NAME/midasserver $DBTYPE
docker run $ENVOPTS $VOLOPTS $NETOPTS -p 127.0.0.1:9091:9091/tcp --rm --name=$CONTAINER_NAME $PACKAGE_NAME/midasserver $DBTYPE
echo '+' docker run $ENVOPTS $VOLOPTS $NETOPTS -p 127.0.0.1:${PORT}:${PORT}/tcp --rm --name=$CONTAINER_NAME $PACKAGE_NAME/midasserver $DBTYPE
docker run $ENVOPTS $VOLOPTS $NETOPTS -p 127.0.0.1:${PORT}:${PORT}/tcp --rm --name=$CONTAINER_NAME $PACKAGE_NAME/midasserver $DBTYPE
fi

0 comments on commit 05e793a

Please sign in to comment.