fix: use directory config mount for casaos
This commit is contained in:
+2
-2
@@ -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:
|
||||
|
||||
@@ -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))
|
||||
|
||||
|
||||
+1
-1
@@ -6,7 +6,7 @@ services:
|
||||
env_file:
|
||||
- .env
|
||||
volumes:
|
||||
- ./config.json:/app/config.json
|
||||
- ./data:/app/data
|
||||
- ./recordings:/app/recordings
|
||||
logging:
|
||||
driver: json-file
|
||||
|
||||
Reference in New Issue
Block a user