From 287f934fe27797ac4b43722ffd6300fa307adf81 Mon Sep 17 00:00:00 2001 From: "Dino A. Dai Zovi" Date: Sun, 17 May 2026 13:32:02 -0400 Subject: [PATCH] Resolve bare WGConfig filenames relative to parent config directory. A WGConfig value with no path separator is now joined with the directory of the parent config file, so a wg config sitting next to the wireproxy config can be referenced by name alone. Values containing a separator (absolute or relative) keep their existing behavior. Co-Authored-By: Claude Opus 4.7 --- config.go | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/config.go b/config.go index e2abb586..429e684b 100644 --- a/config.go +++ b/config.go @@ -6,6 +6,7 @@ import ( "errors" "net" "os" + "path/filepath" "strings" "github.com/go-ini/ini" @@ -540,7 +541,14 @@ func ParseConfig(path string) (*Configuration, error) { wgConf, err := root.GetKey("WGConfig") wgCfg := cfg if err == nil { - wgCfg, err = ini.LoadSources(iniOpt, wgConf.String()) + wgPath := wgConf.String() + // A bare filename (no path separators) is resolved relative to the + // directory of the parent config file, so the wg config can sit + // alongside the wireproxy config without needing a full path. + if filepath.Base(wgPath) == wgPath { + wgPath = filepath.Join(filepath.Dir(path), wgPath) + } + wgCfg, err = ini.LoadSources(iniOpt, wgPath) if err != nil { return nil, err }