summaryrefslogtreecommitdiff
path: root/internal/config
diff options
context:
space:
mode:
authorJames O'Doherty <james@theodohertyfamily.com>2026-05-22 09:18:55 -0400
committerJames O'Doherty <james@theodohertyfamily.com>2026-05-22 09:18:55 -0400
commit96d75d9f1fab87365d7e6b5070eed3a5757c3484 (patch)
treee01144dbb5338826d36f1b07444ebd78407c3bf4 /internal/config
parent756ba94292b408cc4f23d137b2c4c52009b2b38d (diff)
Refactor CLI for testability and implement hermetic config path injection
Diffstat (limited to 'internal/config')
-rw-r--r--internal/config/config.go18
1 files changed, 18 insertions, 0 deletions
diff --git a/internal/config/config.go b/internal/config/config.go
index 5aa8462..d81a1f6 100644
--- a/internal/config/config.go
+++ b/internal/config/config.go
@@ -1,7 +1,25 @@
package config
+import (
+ "os"
+ "path/filepath"
+)
+
type Config struct {
Profile string
DNSServer string
Command []string
}
+
+// GetDefaultProfilesDir returns the standard XDG path for wg-wrap profiles.
+func GetDefaultProfilesDir() string {
+ configHome := os.Getenv("XDG_CONFIG_HOME")
+ if configHome == "" {
+ home, err := os.UserHomeDir()
+ if err != nil {
+ return "etc/wg-wrap/profiles" // Fallback
+ }
+ configHome = filepath.Join(home, ".config")
+ }
+ return filepath.Join(configHome, "wg-wrap", "profiles")
+}