From 1cfd76ae4418429ea93cec683641ebf2b3627c40 Mon Sep 17 00:00:00 2001 From: Pheby Date: Mon, 8 Jun 2026 05:53:51 +0000 Subject: [PATCH] fix: use directory config mount for casaos --- DEPLOYMENT.md | 4 ++-- config.py | 9 +++++++-- docker-compose.yml | 2 +- 3 files changed, 10 insertions(+), 5 deletions(-) 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