MCPcopy Create free account
hub / github.com/PerpetualSoftware/pad / SetBaseURL

Method SetBaseURL

internal/server/server.go:512–523  ·  view source on GitHub ↗

SetBaseURL sets the public base URL used for generating shareable links. If the supplied URL has an unspecified bind-all host ("0.0.0.0", "::", "[::]"), this logs a WARN: such a URL is the right thing to *bind* to but the wrong thing to *send* to a recipient (their browser cannot resolve 0.0.0.0 /

(rawURL string)

Source from the content-addressed store, hash-verified

510// links from such a deployment should set PAD_URL or PUBLIC_URL to the
511// real public hostname (e.g. https://app.getpad.dev). See BUG-899.
512func (s *Server) SetBaseURL(rawURL string) {
513 s.baseURL = strings.TrimRight(rawURL, "/")
514 if s.baseURL == "" {
515 return
516 }
517 if u, err := url.Parse(s.baseURL); err == nil {
518 switch u.Hostname() {
519 case "", "0.0.0.0", "::":
520 slog.Warn("server base URL has an unspecified host; emailed links (password reset, invites, share links) will not be reachable. Set PAD_URL or PUBLIC_URL to the deployment's public URL (e.g. https://app.getpad.dev).", "base_url", s.baseURL)
521 }
522 }
523}
524
525// specialUseTLDs is the (finite) set of reserved top-level names from the IANA
526// Special-Use Domain Names registry + related RFCs that never resolve to a

Callers 2

configureEmailForTestFunction · 0.80
serveCmdFunction · 0.80

Calls

no outgoing calls

Tested by 1

configureEmailForTestFunction · 0.64