mirror of
https://github.com/akuker/RASCSI.git
synced 2024-12-23 21:29:30 +00:00
Make rascsi-web port configurable (#471)
This commit is contained in:
parent
0f222df9a2
commit
111920edb0
@ -55,5 +55,21 @@ else
|
||||
fi
|
||||
fi
|
||||
|
||||
echo "Starting web server..."
|
||||
python3 web.py
|
||||
# parse arguments
|
||||
while [ "$1" != "" ]; do
|
||||
PARAM=$(echo "$1" | awk -F= '{print $1}')
|
||||
VALUE=$(echo "$1" | awk -F= '{print $2}')
|
||||
case $PARAM in
|
||||
-p | --port)
|
||||
PORT=$VALUE
|
||||
;;
|
||||
*)
|
||||
echo "ERROR: unknown parameter \"$PARAM\""
|
||||
exit 1
|
||||
;;
|
||||
esac
|
||||
shift
|
||||
done
|
||||
|
||||
echo "Starting web server on port ${PORT-8080}..."
|
||||
python3 web.py ${PORT}
|
||||
|
@ -3,6 +3,7 @@ Module for the Flask app rendering and endpoints
|
||||
"""
|
||||
|
||||
import logging
|
||||
from sys import argv
|
||||
from pathlib import Path
|
||||
|
||||
from flask import (
|
||||
@ -820,6 +821,11 @@ if __name__ == "__main__":
|
||||
if Path(f"{CFG_DIR}/{DEFAULT_CONFIG}").is_file():
|
||||
read_config(DEFAULT_CONFIG)
|
||||
|
||||
if len(argv) > 1:
|
||||
port = int(argv[1])
|
||||
else:
|
||||
port = 8080
|
||||
|
||||
import bjoern
|
||||
print("Serving rascsi-web...")
|
||||
bjoern.run(APP, "0.0.0.0", 8080)
|
||||
bjoern.run(APP, "0.0.0.0", port)
|
||||
|
Loading…
Reference in New Issue
Block a user