6
1
mirror of https://git.mills.io/saltyim/saltyim.git synced 2024-06-20 22:08:21 +00:00

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

Co-authored-by: Jon Lundy <jon@xuu.cc>
Reviewed-on: https://git.mills.io/saltyim/saltyim/pulls/175
Reviewed-by: James Mills <james@mills.io>
Co-authored-by: xuu <xuu@noreply@mills.io>
Co-committed-by: xuu <xuu@noreply@mills.io>
This commit is contained in:
xuu 2022-10-15 21:45:13 +00:00 committed by James Mills
parent 37135ce6af
commit 318c3275b5
6 changed files with 9 additions and 1 deletions

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.