diff --git a/DEPLOYMENT.md b/DEPLOYMENT.md index 32c8d4c..91d8b7a 100644 --- a/DEPLOYMENT.md +++ b/DEPLOYMENT.md @@ -40,7 +40,7 @@ docker compose up -d --build ### Persistent data The compose file stores: -- `config.json` — saved channel settings +- `data/config.json` — saved channel settings - `recordings/` — temporary meeting audio ### CasaOS setup @@ -54,7 +54,7 @@ Use a persistent directory like: ``` Mount it so the container sees: -- `/app/config.json` +- `/app/data` - `/app/recordings` Make sure the container gets these environment variables: diff --git a/config.py b/config.py index 4785148..3c95eb3 100644 --- a/config.py +++ b/config.py @@ -1,12 +1,16 @@ import json -import aiofiles +import os from pathlib import Path from typing import Optional -CONFIG_PATH = Path("config.json") +import aiofiles + +CONFIG_PATH = Path(os.getenv("CONFIG_PATH", "/app/data/config.json")) async def load_config() -> dict: + if CONFIG_PATH.is_dir(): + return {} if not CONFIG_PATH.exists(): return {} async with aiofiles.open(CONFIG_PATH, "r") as f: @@ -15,6 +19,7 @@ async def load_config() -> dict: async def save_config(config: dict) -> None: + CONFIG_PATH.parent.mkdir(parents=True, exist_ok=True) async with aiofiles.open(CONFIG_PATH, "w") as f: await f.write(json.dumps(config, indent=2)) diff --git a/docker-compose.yml b/docker-compose.yml index 664db9b..7d6eeb9 100644 --- a/docker-compose.yml +++ b/docker-compose.yml @@ -6,7 +6,7 @@ services: env_file: - .env volumes: - - ./config.json:/app/config.json + - ./data:/app/data - ./recordings:/app/recordings logging: driver: json-file