From b5df6ab91f64b4b4708c506ce9c09ed329273625 Mon Sep 17 00:00:00 2001 From: Tobias Gesellchen Date: Fri, 13 Feb 2026 00:00:45 +0100 Subject: [PATCH] Include SERVER_URL and HTTPS_SERVER_URL hostnames in TLS certificate SANs --- cmd/soundtouch-service/main.go | 33 +++++++++++++++++++++++---------- 1 file changed, 23 insertions(+), 10 deletions(-) diff --git a/cmd/soundtouch-service/main.go b/cmd/soundtouch-service/main.go index 914c762..2c87670 100644 --- a/cmd/soundtouch-service/main.go +++ b/cmd/soundtouch-service/main.go @@ -124,16 +124,29 @@ func loadConfig() serviceConfig { hostname = strings.ToLower(hostname) - domains := []string{ - "streaming.bose.com", - "updates.bose.com", - "stats.bose.com", - "bmx.bose.com", - "content.api.bose.io", - setup.TestDomain, - hostname, - "localhost", - "127.0.0.1", + domainsMap := map[string]bool{ + "streaming.bose.com": true, + "updates.bose.com": true, + "stats.bose.com": true, + "bmx.bose.com": true, + "content.api.bose.io": true, + setup.TestDomain: true, + hostname: true, + "localhost": true, + "127.0.0.1": true, + } + + if u, err := url.Parse(serverURL); err == nil && u.Hostname() != "" { + domainsMap[strings.ToLower(u.Hostname())] = true + } + + if u, err := url.Parse(httpsServerURL); err == nil && u.Hostname() != "" { + domainsMap[strings.ToLower(u.Hostname())] = true + } + + domains := make([]string, 0, len(domainsMap)) + for d := range domainsMap { + domains = append(domains, d) } return serviceConfig{