summaryrefslogtreecommitdiff
path: root/internal/config/config.go
diff options
context:
space:
mode:
Diffstat (limited to 'internal/config/config.go')
-rw-r--r--internal/config/config.go14
1 files changed, 11 insertions, 3 deletions
diff --git a/internal/config/config.go b/internal/config/config.go
index da7f264..12adf68 100644
--- a/internal/config/config.go
+++ b/internal/config/config.go
@@ -1,6 +1,8 @@
package config
import (
+ "errors"
+ "fmt"
"os"
"path/filepath"
)
@@ -16,8 +18,14 @@ type Config struct {
WebhookURL string `toml:"webhook_url"`
}
-func Default() *Config {
- home, _ := os.UserHomeDir()
+func Default() (*Config, error) {
+ home, err := os.UserHomeDir()
+ if err != nil {
+ return nil, fmt.Errorf("cannot determine home directory: %w", err)
+ }
+ if home == "" {
+ return nil, errors.New("cannot determine home directory: HOME is empty")
+ }
dataDir := filepath.Join(home, ".claudomator")
return &Config{
DataDir: dataDir,
@@ -27,7 +35,7 @@ func Default() *Config {
MaxConcurrent: 3,
DefaultTimeout: "15m",
ServerAddr: ":8484",
- }
+ }, nil
}
// EnsureDirs creates the data directory structure.