summaryrefslogtreecommitdiff
path: root/internal/config/config.go
blob: d81a1f6fe1fd9675336ed3f6f89989ce6f152751 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
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")
}