v0.27.1 packaging update, install and initial config

This commit is contained in:
lixen committed 2026-10-06 00:14:05 -04:00
1 parent 60abc97eb0
commit 4513a9e62b
15 files changed
+431 -110

No files matched your search

+16 -2
View File
@@ -219,11 +219,25 @@ func resolveConfigPath(file string) (path string, isExplicit bool) {
if configDir := os.Getenv("LOGWISP_CONFIG_DIR"); configDir != "" {
return filepath.Join(configDir, "logwisp.toml"), true
}
if homeDir, err := os.UserHomeDir(); err == nil {
path = filepath.Join(homeDir, ".config", "logwisp", "logwisp.toml")
if path, err := UserFile(); err == nil {
if _, err := os.Stat(path); err == nil {
return path, false
}
}
return "logwisp.toml", false
}
// DefaultPath is the file lw reads without -c
func DefaultPath() string {
path, _ := resolveConfigPath("")
return path
}
// UserFile is ~/.config/logwisp/logwisp.toml, the file lw reads first without -c
func UserFile() (string, error) {
home, err := os.UserHomeDir()
if err != nil {
return "", err
}
return filepath.Join(home, ".config", "logwisp", "logwisp.toml"), nil
}