fix docker defaults to writable /data config path and align docs

This commit is contained in:
CJACK.
2026-04-29 13:46:22 +08:00
parent d7125ea106
commit 2c8409dcbb
9 changed files with 35 additions and 7 deletions

View File

@@ -30,6 +30,11 @@ func ResolvePath(envKey, defaultRel string) string {
}
func ConfigPath() string {
if strings.TrimSpace(os.Getenv("DS2API_CONFIG_PATH")) == "" && BaseDir() == "/app" {
// Official container images commonly run from /app where filesystem may be read-only.
// Prefer /data default so deployments can persist config/token state by mounting a volume.
return "/data/config.json"
}
return ResolvePath("DS2API_CONFIG_PATH", "config.json")
}