Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
11 changes: 5 additions & 6 deletions backend/internal/config/config.go
Original file line number Diff line number Diff line change
Expand Up @@ -189,23 +189,22 @@ func resolveRunFilePath() (string, error) {
if p, ok := os.LookupEnv("AO_RUN_FILE"); ok && p != "" {
return p, nil
}
dir, err := os.UserConfigDir()
home, err := os.UserHomeDir()
if err != nil {
return "", fmt.Errorf("resolve state dir: %w", err)
}
return filepath.Join(dir, "agent-orchestrator", "running.json"), nil
return filepath.Join(home, ".ao", "running.json"), nil
}

// resolveDataDir picks where durable state (the SQLite DB) lives. An explicit
// AO_DATA_DIR wins; otherwise it sits under the per-user config directory
// alongside running.json.
// AO_DATA_DIR wins; otherwise it defaults to ~/.ao/data/.
func resolveDataDir() (string, error) {
if p, ok := os.LookupEnv("AO_DATA_DIR"); ok && p != "" {
return p, nil
}
dir, err := os.UserConfigDir()
home, err := os.UserHomeDir()
if err != nil {
return "", fmt.Errorf("resolve state dir: %w", err)
}
return filepath.Join(dir, "agent-orchestrator", "data"), nil
return filepath.Join(home, ".ao", "data"), nil
}
8 changes: 4 additions & 4 deletions backend/internal/config/config_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -33,14 +33,14 @@ func TestLoadDefaults(t *testing.T) {
if cfg.RunFilePath == "" {
t.Error("RunFilePath is empty, want a resolved default path")
}
if !strings.HasSuffix(cfg.RunFilePath, filepath.Join("agent-orchestrator", "running.json")) {
t.Errorf("RunFilePath = %q, want agent-orchestrator/running.json suffix", cfg.RunFilePath)
if !strings.HasSuffix(cfg.RunFilePath, filepath.Join(".ao", "running.json")) {
t.Errorf("RunFilePath = %q, want .ao/running.json suffix", cfg.RunFilePath)
}
if cfg.DataDir == "" {
t.Error("DataDir is empty, want a resolved default path")
}
if !strings.HasSuffix(cfg.DataDir, filepath.Join("agent-orchestrator", "data")) {
t.Errorf("DataDir = %q, want agent-orchestrator/data suffix", cfg.DataDir)
if !strings.HasSuffix(cfg.DataDir, filepath.Join(".ao", "data")) {
t.Errorf("DataDir = %q, want .ao/data suffix", cfg.DataDir)
}
}

Expand Down
Loading