- Fix GNIZA_CONFIG_DIR in systemd service: /usr/local/gniza/etc -> /etc/gniza - Add LOG_DIR and PYTHONPATH to systemd environment - Fix default CONFIG_DIR in web/app.py and web/__main__.py - Refactor install.sh web setup into function for robustness - Replace Unicode box-drawing chars with ASCII in install.sh - Read from /dev/tty to prevent stdin issues Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
29 lines
653 B
Python
29 lines
653 B
Python
import os
|
|
import sys
|
|
from pathlib import Path
|
|
|
|
from web.app import create_app, parse_conf
|
|
|
|
CONFIG_DIR = Path(os.environ.get("GNIZA_CONFIG_DIR", "/etc/gniza"))
|
|
|
|
|
|
def main():
|
|
# Read defaults from config
|
|
conf = parse_conf(CONFIG_DIR / "gniza.conf")
|
|
host = conf.get("WEB_HOST", "0.0.0.0")
|
|
port = int(conf.get("WEB_PORT", "8080"))
|
|
|
|
# CLI overrides
|
|
for arg in sys.argv[1:]:
|
|
if arg.startswith("--port="):
|
|
port = int(arg.split("=", 1)[1])
|
|
elif arg.startswith("--host="):
|
|
host = arg.split("=", 1)[1]
|
|
|
|
app = create_app()
|
|
app.run(host=host, port=port)
|
|
|
|
|
|
if __name__ == "__main__":
|
|
main()
|