Browse Source

config: hub.port is optional, allow putting full URL in hub.address field

tags/v1.3.0
mappu 1 year ago
parent
commit
36f49749ad
2 changed files with 7 additions and 2 deletions
  1. 1
    1
      Config.go
  2. 6
    1
      main.go

+ 1
- 1
Config.go View File

@@ -17,7 +17,7 @@ type Config struct {

Hub struct {
Address string `json:"address"`
Port int `json:"port"`
Port int `json:"port,omitempty"`
Tag string `json:"tag"`
}
}

+ 6
- 1
main.go View File

@@ -48,8 +48,13 @@ func (this *App) HubWorker(Nick, Pass string, so socketio.Socket, done chan stru
selfUser.ClientTag = this.cfg.Hub.Tag
selfUser.ClientVersion = libnmdc.DEFAULT_CLIENT_VERSION

url := this.cfg.Hub.Address
if this.cfg.Hub.Port == 0 {
url = fmt.Sprintf("%s:%d", this.cfg.Hub.Address, this.cfg.Hub.Port)
}

hco := libnmdc.HubConnectionOptions{
Address: libnmdc.HubAddress(fmt.Sprintf("%s:%d", this.cfg.Hub.Address, this.cfg.Hub.Port)),
Address: libnmdc.HubAddress(url),
Self: selfUser,
NickPassword: Pass,
}

Loading…
Cancel
Save