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
|
### Persistent data
|
||||||
|
|
||||||
The compose file stores:
|
The compose file stores:
|
||||||
- `config.json` — saved channel settings
|
- `data/config.json` — saved channel settings
|
||||||
- `recordings/` — temporary meeting audio
|
- `recordings/` — temporary meeting audio
|
||||||
|
|
||||||
### CasaOS setup
|
### CasaOS setup
|
||||||
@@ -54,7 +54,7 @@ Use a persistent directory like:
|
|||||||
```
|
```
|
||||||
|
|
||||||
Mount it so the container sees:
|
Mount it so the container sees:
|
||||||
- `/app/config.json`
|
- `/app/data`
|
||||||
- `/app/recordings`
|
- `/app/recordings`
|
||||||
|
|
||||||
Make sure the container gets these environment variables:
|
Make sure the container gets these environment variables:
|
||||||
|
|||||||
@@ -1,12 +1,16 @@
|
|||||||
import json
|
import json
|
||||||
import aiofiles
|
import os
|
||||||
from pathlib import Path
|
from pathlib import Path
|
||||||
from typing import Optional
|
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:
|
async def load_config() -> dict:
|
||||||
|
if CONFIG_PATH.is_dir():
|
||||||
|
return {}
|
||||||
if not CONFIG_PATH.exists():
|
if not CONFIG_PATH.exists():
|
||||||
return {}
|
return {}
|
||||||
async with aiofiles.open(CONFIG_PATH, "r") as f:
|
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:
|
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:
|
async with aiofiles.open(CONFIG_PATH, "w") as f:
|
||||||
await f.write(json.dumps(config, indent=2))
|
await f.write(json.dumps(config, indent=2))
|
||||||
|
|
||||||
|
|||||||
+1
-1
@@ -6,7 +6,7 @@ services:
|
|||||||
env_file:
|
env_file:
|
||||||
- .env
|
- .env
|
||||||
volumes:
|
volumes:
|
||||||
- ./config.json:/app/config.json
|
- ./data:/app/data
|
||||||
- ./recordings:/app/recordings
|
- ./recordings:/app/recordings
|
||||||
logging:
|
logging:
|
||||||
driver: json-file
|
driver: json-file
|
||||||
|
|||||||
Reference in New Issue
Block a user