Allow sending correct public name in autodiscovery

This commit is contained in:
Melora Hugues 2024-03-27 22:07:09 +01:00
parent b1e9a2099e
commit b250a6b3c8
2 changed files with 9 additions and 5 deletions

View file

@ -48,10 +48,11 @@ type jsonConf struct {
StaticDir string `json:"staticPath"`
} `json:"storage"`
Server struct {
Host string `json:"host"`
Port int `json:"port"`
Mode string `json:"mode"`
SockPath string `json:"sock"`
Host string `json:"host"`
Port int `json:"port"`
Mode string `json:"mode"`
SockPath string `json:"sock"`
PublicHost string `json:"public_host"`
} `json:"server"`
BootProvider struct {
Iface string `json:"interface"`
@ -67,6 +68,7 @@ type AppConfig struct {
DataFilepath string
StaticDir string
Host string
PublicHost string
Port int
SockPath string
UPDMcastGroup string
@ -98,6 +100,7 @@ func (ac *AppConfig) UnmarshalJSON(data []byte) error {
ac.ServerMode = lm
ac.SockPath = jsonConf.Server.SockPath
ac.Host = jsonConf.Server.Host
ac.PublicHost = jsonConf.Server.PublicHost
ac.Port = jsonConf.Server.Port
ac.UPDMcastGroup = jsonConf.BootProvider.McastGroup
ac.UDPIface = jsonConf.BootProvider.Iface
@ -113,6 +116,7 @@ var defaultConfig AppConfig = AppConfig{
ServerMode: ModeNet,
DataFilepath: "boot_options.json",
Host: "0.0.0.0",
PublicHost: "http://127.0.0.1:5000",
Port: 5000,
UPDMcastGroup: "ff02::abcd:1234",
UDPPort: 42,

View file

@ -28,7 +28,7 @@ type discoveryPayload struct {
func payloadFromConfig(conf config.AppConfig) discoveryPayload {
return discoveryPayload{
ManagementAddress: conf.Host,
ManagementAddress: conf.PublicHost,
Version: "1",
}
}