1
0
Fork 0

chore: minor fixes

This commit is contained in:
Arthur K. 2026-01-23 11:13:44 +03:00
parent 0448f66ab2
commit 2af9e734dd
Signed by: wzray
GPG key ID: B97F30FDC4636357
6 changed files with 28 additions and 15 deletions

View file

@ -23,6 +23,8 @@ type Role struct {
externalDomains []string // TODO: i don't like hardcoding external/internal logic here
internalDomains []string
lock sync.RWMutex
}
func New(state *app.State, config config.HostConfig) *Role {
@ -56,6 +58,9 @@ func (r *Role) sendUpdate(domains []string, role types.Role) {
}
func (r *Role) OnTraefikUpdate(resp traefikResponse) {
r.lock.Lock()
defer r.lock.Unlock()
newInternal := resp.Domains(r.config.InternalEntrypoint)
newExternal := resp.Domains(r.config.ExternalEntrypoint)
@ -73,6 +78,9 @@ func (r *Role) OnTraefikUpdate(resp traefikResponse) {
}
func (r *Role) Dns() (types.HostState, error) {
r.lock.RLock()
defer r.lock.RUnlock()
return types.HostState{
Domains: r.internalDomains,
Address: r.config.IpAddress,
@ -81,6 +89,9 @@ func (r *Role) Dns() (types.HostState, error) {
}
func (r *Role) Nameserver() (types.HostState, error) {
r.lock.RLock()
defer r.lock.RUnlock()
return types.HostState{
Domains: r.externalDomains,
Address: r.config.IpAddress,