1
0
Fork 0

chore: unify naming for node related types

This commit is contained in:
Arthur K. 2026-01-18 01:08:52 +03:00
parent b8cde30581
commit 6b170e4c5a
Signed by: wzray
GPG key ID: B97F30FDC4636357
12 changed files with 72 additions and 53 deletions

View file

@ -48,10 +48,10 @@ func parseState(state types.HostState) (string, []byte) {
var builder strings.Builder
for _, d := range state.Domains {
builder.WriteString(fmt.Sprintf("%s %s\n", state.Endpoint, d))
builder.WriteString(fmt.Sprintf("%s %s\n", state.Address, d))
}
return hostsDir + state.Name, []byte(builder.String())
return hostsDir + state.Hostname, []byte(builder.String())
}
func (r *Role) OnStartup(ctx context.Context) error {
@ -76,15 +76,15 @@ func (r *Role) OnStartup(ctx context.Context) error {
func (r *Role) syncFromRegistry() {
for _, n := range r.state.Registry.ByRole(types.HostRole) {
state, err := client.Get[types.HostState](n.Address, types.PathHostDns)
state, err := client.Get[types.HostState](n.Endpoint, types.PathHostDns)
if err != nil {
log.Warn().Str("name", n.Name).Err(err).Msg("unable to get host config")
log.Warn().Str("name", n.Hostname).Err(err).Msg("unable to get host config")
continue
}
filename, data := parseState(*state)
if err := r.updateDnsmasq(filename, data); err != nil {
log.Warn().Str("name", n.Name).Err(err).Msg("unable to update dnsmasq")
log.Warn().Str("name", n.Hostname).Err(err).Msg("unable to update dnsmasq")
continue
}
}