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

View file

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