summaryrefslogtreecommitdiff
path: root/internal/configuration/schema
diff options
context:
space:
mode:
authorJames Elliott <james-d-elliott@users.noreply.github.com>2024-02-18 21:23:05 +1100
committerGitHub <noreply@github.com>2024-02-18 21:23:05 +1100
commitd88b360813117f165123cb07a8bf7e450b0d79c2 (patch)
tree93d3487b01939b3dea4625716e3bb019eda4fdaf /internal/configuration/schema
parent623f3552573bf2209ec6a1c4ed9f5797be316ed6 (diff)
refactor(configuration): adjust router path resolution for unix socket (#6694)
This adjusts the router path resoultion to make more sense for the unix socket address based listeners.
Diffstat (limited to 'internal/configuration/schema')
-rw-r--r--internal/configuration/schema/types_address.go8
-rw-r--r--internal/configuration/schema/types_address_test.go4
2 files changed, 8 insertions, 4 deletions
diff --git a/internal/configuration/schema/types_address.go b/internal/configuration/schema/types_address.go
index 37bd8d7d8..012cc72ba 100644
--- a/internal/configuration/schema/types_address.go
+++ b/internal/configuration/schema/types_address.go
@@ -389,8 +389,12 @@ func (a *Address) RouterPath() string {
return ""
}
- if a.url.Query().Has("path") {
- return fmt.Sprintf("/%s", a.url.Query().Get("path"))
+ if a.socket {
+ if a.url.Query().Has("path") {
+ return fmt.Sprintf("/%s", a.url.Query().Get("path"))
+ }
+
+ return "/"
}
return a.url.Path
diff --git a/internal/configuration/schema/types_address_test.go b/internal/configuration/schema/types_address_test.go
index a5baee7be..f4408757e 100644
--- a/internal/configuration/schema/types_address_test.go
+++ b/internal/configuration/schema/types_address_test.go
@@ -634,7 +634,7 @@ func TestAddress_UnixDomainSocket(t *testing.T) {
fmt.Sprintf("unix://%s", filepath.Join(dir, "example.sock")),
true,
filepath.Join(dir, "example.sock"),
- filepath.Join(dir, "example.sock"),
+ "/",
"",
-1,
"",
@@ -644,7 +644,7 @@ func TestAddress_UnixDomainSocket(t *testing.T) {
fmt.Sprintf("unix://%s?umask=0022", filepath.Join(dir, "example.sock")),
true,
filepath.Join(dir, "example.sock"),
- filepath.Join(dir, "example.sock"),
+ "/",
"0022",
18,
"",