chore: minor fixes
This commit is contained in:
parent
0448f66ab2
commit
2af9e734dd
6 changed files with 28 additions and 15 deletions
|
|
@ -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,
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue