From 060fd75cb9304927c5867381693388bb31540744 Mon Sep 17 00:00:00 2001 From: Gamosoft Date: Fri, 16 Jan 2026 12:12:51 +0100 Subject: [PATCH] fix port from config.yaml --- run.py | 25 +++++++++++++++++++++++-- 1 file changed, 23 insertions(+), 2 deletions(-) diff --git a/run.py b/run.py index 0d3b7a9..d19e3bc 100644 --- a/run.py +++ b/run.py @@ -15,6 +15,27 @@ try: except ImportError: colorama = None +def get_port(): + """Get port from: 1) ENV variable, 2) config.yaml, 3) default 8000""" + # Priority 1: Environment variable + if os.getenv("PORT"): + return os.getenv("PORT") + + # Priority 2: config.yaml + config_path = Path("config.yaml") + if config_path.exists(): + try: + import yaml + with open(config_path, 'r', encoding='utf-8') as f: + config = yaml.safe_load(f) + if config and 'server' in config and 'port' in config['server']: + return str(config['server']['port']) + except Exception: + pass # Fall through to default + + # Priority 3: Default + return "8000" + def main(): print("🚀 Starting NoteDiscovery...\n") @@ -30,8 +51,8 @@ def main(): Path("data").mkdir(parents=True, exist_ok=True) Path("plugins").mkdir(parents=True, exist_ok=True) - # Get port from environment variable or use default - port = os.getenv("PORT", "8000") + # Get port from config or environment + port = get_port() print("✓ Dependencies installed") print("✓ Directories created")