allow port and host configuration

This commit is contained in:
flukx 2024-08-16 16:28:15 +02:00
parent c64f2e4232
commit 03e1bf23e3

View file

@ -2,6 +2,7 @@
import argparse
import asyncio
import itertools
import json
import re
import time
from typing import Optional, Iterable, Callable
@ -277,8 +278,16 @@ def show_part_changer(ui_element: nicegui.ui.element, part: Part) -> None:
if __name__ in {"__main__", "__mp_main__"}:
nicegui.app.add_static_files('/images_landscape', 'images_landscape')
search_page(load_data())
options = {}
try:
option_file = open('flinventory-config.json')
except FileNotFoundError:
pass
else:
with option_file:
options = json.load(option_file)
ui.run(title="Fahrradteile",
favicon="website_resources/favicon.ico",
language="de",
# host="192.168.178.133",
port=11111)
host=options.get("host", "0.0.0.0"),
port=options.get("port", 11111))