improving config

This commit is contained in:
2026-03-02 23:51:50 +01:00
parent 6cfea15b9e
commit caa2bd4897
5 changed files with 70 additions and 1 deletions

11
main.py
View File

@@ -1,6 +1,7 @@
#!/usr/bin/env python3
import os
import sys
import time
import logging
import yaml
@@ -234,8 +235,16 @@ class LogFileHandler(FileSystemEventHandler):
def main():
try:
# Parse command line arguments
config_path = "config.yaml"
if len(sys.argv) > 1:
if sys.argv[1] == '--config' and len(sys.argv) > 2:
config_path = sys.argv[2]
elif sys.argv[1].endswith('.yaml') or sys.argv[1].endswith('.yml'):
config_path = sys.argv[1]
# Load configuration
config = Config()
config = Config(config_path)
# Set log level from config
service_config = config.get_service_config()