feat: add docker deployment

This commit is contained in:
Yoilun
2026-05-25 22:41:12 +08:00
parent 8c1093a53c
commit 4262191462
9 changed files with 225 additions and 4 deletions

View File

@@ -9,14 +9,19 @@ type Config struct {
CodexHome string
HTTPAddr string
WorkspaceRoot string
StaticDir string
}
func DefaultConfig() Config {
httpAddr := envOrDefault("HTTP_ADDR", "127.0.0.1:18083")
staticDir := os.Getenv("STATIC_DIR")
workspaceRoot := envOrDefault("WORKSPACE_ROOT", ".")
if codexHome := os.Getenv("CODEX_HOME"); codexHome != "" {
return Config{
CodexHome: codexHome,
HTTPAddr: "127.0.0.1:18083",
WorkspaceRoot: ".",
HTTPAddr: httpAddr,
WorkspaceRoot: workspaceRoot,
StaticDir: staticDir,
}
}
home, err := os.UserHomeDir()
@@ -25,7 +30,15 @@ func DefaultConfig() Config {
}
return Config{
CodexHome: filepath.Join(home, ".codex"),
HTTPAddr: "127.0.0.1:18083",
WorkspaceRoot: ".",
HTTPAddr: httpAddr,
WorkspaceRoot: workspaceRoot,
StaticDir: staticDir,
}
}
func envOrDefault(name string, fallback string) string {
if value := os.Getenv(name); value != "" {
return value
}
return fallback
}