1b4448afb4
teabot watches Gitea repos and dispatches one-shot Claude Code sessions in Docker containers to work issues and review PRs, acting as configurable bot personalities. Claude-Session: https://claude.ai/code/session_015ur3i7D2azsMAWTSVABApv
37 lines
865 B
Go
37 lines
865 B
Go
package config
|
|
|
|
import (
|
|
"os"
|
|
"path/filepath"
|
|
)
|
|
|
|
// DefaultConfigPath returns $XDG_CONFIG_HOME/teabot/config.yaml
|
|
// (default ~/.config/teabot/config.yaml).
|
|
func DefaultConfigPath() string {
|
|
base := os.Getenv("XDG_CONFIG_HOME")
|
|
if base == "" {
|
|
home, _ := os.UserHomeDir()
|
|
base = filepath.Join(home, ".config")
|
|
}
|
|
return filepath.Join(base, AppName, "config.yaml")
|
|
}
|
|
|
|
// DefaultStateDir returns $XDG_STATE_HOME/teabot
|
|
// (default ~/.local/state/teabot).
|
|
func DefaultStateDir() string {
|
|
base := os.Getenv("XDG_STATE_HOME")
|
|
if base == "" {
|
|
home, _ := os.UserHomeDir()
|
|
base = filepath.Join(home, ".local", "state")
|
|
}
|
|
return filepath.Join(base, AppName)
|
|
}
|
|
|
|
// StateDirOrDefault resolves the effective state directory for the config.
|
|
func (c *Config) StateDirOrDefault() string {
|
|
if c.StateDir != "" {
|
|
return c.StateDir
|
|
}
|
|
return DefaultStateDir()
|
|
}
|