fix: Make register lookup broker if default to blank (#175)

Co-authored-by: Jon Lundy <jon@xuu.cc>
Reviewed-on: #175
Reviewed-by: James Mills <james@mills.io>
Co-authored-by: xuu <xuu@noreply@mills.io>
Co-committed-by: xuu <xuu@noreply@mills.io>
master
xuu 2 months ago committed by James Mills
parent 37135ce6af
commit 318c3275b5
  1. 1
      .gitignore
  2. 2
      internal/config.go
  3. 4
      internal/options.go
  4. 2
      internal/pwa/components/configuration.go
  5. 1
      internal/server.go
  6. BIN
      internal/web/app.wasm

1
.gitignore vendored

@ -26,3 +26,4 @@
/echobot.sh
/execbot.sh
environ.inc

@ -17,7 +17,9 @@ type Config struct {
Data string `json:"-"`
Store string `json:"-"`
BaseURL string
BrokerURI string
PrimaryDomain string
AdminUser string `json:"-"`

@ -120,6 +120,10 @@ func WithBaseURL(baseURL string) Option {
return err
}
cfg.BaseURL = baseURL
if baseURL != DefaultBaseURL {
cfg.BrokerURI = baseURL
}
cfg.baseURL = u
return nil
}

@ -121,7 +121,7 @@ func (c *Configuration) registerIdentity() func(button app.HTMLButton) {
log.Println("error", err)
return
}
err = registerClient.Register(app.Getenv("BaseURL"))
err = registerClient.Register(app.Getenv("BrokerURI"))
if err != nil { // TODO: pop dialog
log.Println("error", err)
c.dialog.ShowError("error registering to broker: ", err.Error())

@ -289,6 +289,7 @@ func (s *Server) initRoutes() {
Env: map[string]string{
"BaseURL": strings.TrimSuffix(s.config.BaseURL, "/"),
"BrokerURI": strings.TrimSuffix(s.config.BrokerURI, "/"),
"LookupEndpoint": strings.TrimSuffix(s.config.BaseURL, "/") + "/api/v1/lookup/",
"SendEndpoint": strings.TrimSuffix(s.config.BaseURL, "/") + "/api/v1/send",
},

Binary file not shown.
Loading…
Cancel
Save