chore: fix env values

Kim committed Nov 19, 2025 at 14:35 UTC ab0d6a9bba6982ffac8b91c9073481367de12661
6 files changed +20 -20
Dockerfile
+1 -1
@@ -26,7 +26,7 @@ FROM gcr.io/distroless/static-debian12:nonroot
26 COPY --from=builder /src/bin/relay-server /usr/bin/relay-server
27
28 ENV PORTAL_URL=http://localhost:4017
29 -ENV PORTAL_SUBDOMAIN_URL=http://*.localhost:4017
29 +ENV PORTAL_APP_URL=http://*.localhost:4017
30 ENV BOOTSTRAP_URIS=ws://localhost:4017/relay
31
32 EXPOSE 4017
README.md
+1 -1
@@ -49,7 +49,7 @@ http://localhost:4017
49 #
50 # Then edit docker-compose.yml environment for your domain:
51 PORTAL_URL: https://portal.example.com
52 -PORTAL_SUBDOMAIN_URL: https://*.example.com
52 +PORTAL_APP_URL: https://*.example.com
53 BOOTSTRAP_URIS: wss://portal.example.com/relay
54
55 ```
cmd/relay-server/main.go
+13 -13
@@ -19,13 +19,13 @@ import (
19 )
20
21 var (
22 - flagPortalURL string
23 - flagPortalSubdomainURL string
24 - flagBootstraps []string
25 - flagALPN string
26 - flagPort int
27 - flagMaxLease int
28 - flagLeaseBPS int
22 + flagPortalURL string
23 + flagPortalAppURL string
24 + flagBootstraps []string
25 + flagALPN string
26 + flagPort int
27 + flagMaxLease int
28 + flagLeaseBPS int
29 )
30
31 func main() {
@@ -36,9 +36,9 @@ func main() {
36 // Prefer explicit scheme for localhost so downstream URL building is unambiguous
37 defaultPortalURL = "http://localhost:4017"
38 }
39 - defaultSubdomain := os.Getenv("PORTAL_SUBDOMAIN_URL")
40 - if defaultSubdomain == "" {
41 - defaultSubdomain = utils.DefaultSubdomainPattern(defaultPortalURL)
39 + defaultAppURL := os.Getenv("PORTAL_APP_URL")
40 + if defaultAppURL == "" {
41 + defaultAppURL = utils.DefaultAppPattern(defaultPortalURL)
42 }
43 defaultBootstraps := os.Getenv("BOOTSTRAP_URIS")
44 if defaultBootstraps == "" {
@@ -47,7 +47,7 @@ func main() {
47
48 var flagBootstrapsCSV string
49 flag.StringVar(&flagPortalURL, "portal-url", defaultPortalURL, "base URL for portal frontend (env: PORTAL_URL)")
50 - flag.StringVar(&flagPortalSubdomainURL, "portal-subdomain-url", defaultSubdomain, "subdomain wildcard URL (env: PORTAL_SUBDOMAIN_URL)")
50 + flag.StringVar(&flagPortalAppURL, "portal-app-url", defaultAppURL, "subdomain wildcard URL (env: PORTAL_APP_URL)")
51 flag.StringVar(&flagBootstrapsCSV, "bootstraps", defaultBootstraps, "bootstrap addresses (comma-separated)")
52 flag.StringVar(&flagALPN, "alpn", "http/1.1", "ALPN identifier for this service")
53 flag.IntVar(&flagPort, "port", 4017, "app UI and HTTP proxy port")
@@ -66,8 +66,8 @@ func runServer() error {
66 defer stop()
67
68 log.Info().
69 - Str("frontend_base_url", flagPortalURL).
70 - Str("subdomain_pattern", flagPortalSubdomainURL).
69 + Str("portal_base_url", flagPortalURL).
70 + Str("app_url", flagPortalAppURL).
71 Str("bootstrap_uris", strings.Join(flagBootstraps, ",")).
72 Msg("[server] frontend configuration")
73
cmd/relay-server/view.go
+2 -2
@@ -138,7 +138,7 @@ func serveHTTP(addr string, serv *portal.RelayServer, nodeID string, bootstraps
138 handler := http.HandlerFunc(func(w http.ResponseWriter, r *http.Request) {
139 // Route subdomain requests (e.g., *.example.com) to portalMux
140 // and everything else to the app UI mux.
141 - if utils.IsSubdomain(flagPortalSubdomainURL, r.Host) {
141 + if utils.IsSubdomain(flagPortalAppURL, r.Host) {
142 portalMux.ServeHTTP(w, r)
143 } else {
144 appMux.ServeHTTP(w, r)
@@ -268,7 +268,7 @@ func convertLeaseEntriesToRows(serv *portal.RelayServer) []leaseRow {
268 }
269
270 // Build link using the configured subdomain base
271 - base := flagPortalSubdomainURL
271 + base := flagPortalAppURL
272 if base == "" {
273 base = flagPortalURL
274 }
docker-compose.yml
+1 -1
@@ -9,7 +9,7 @@ services:
9 - "${PORTAL_PORT:-4017}"
10 environment:
11 PORTAL_URL: ${PORTAL_URL:-http://localhost:${PORTAL_PORT:-4017}}
12 - PORTAL_SUBDOMAIN_URL: ${PORTAL_SUBDOMAIN_URL:-http://*.localhost:${PORTAL_PORT:-4017}}
12 + PORTAL_APP_URL: ${PORTAL_APP_URL:-http://*.localhost:${PORTAL_PORT:-4017}}
13 BOOTSTRAP_URIS: ${BOOTSTRAP_URIS:-ws://localhost:${PORTAL_PORT:-4017}/relay}
14 ports:
15 - "4017:4017"
utils/utils.go
+2 -2
@@ -259,13 +259,13 @@ func StripPort(s string) string {
259 return s
260 }
261
262 -// DefaultSubdomainPattern builds a wildcard subdomain pattern from a base portal URL or host.
262 +// DefaultAppPattern builds a wildcard subdomain pattern from a base portal URL or host.
263 // Examples:
264 // - "https://portal.example.com" -> "*.portal.example.com"
265 // - "portal.example.com" -> "*.portal.example.com"
266 // - "localhost:4017" -> "*.localhost:4017"
267 // - "" -> "*.localhost:4017"
268 -func DefaultSubdomainPattern(base string) string {
268 +func DefaultAppPattern(base string) string {
269 base = strings.TrimSpace(strings.TrimSuffix(base, "/"))
270 if base == "" {
271 return "*.localhost:4017"