Skip to content

Commit 31d485b

Browse files
authored
Merge pull request #3494 from gravitl/v0.99_fixes
v0.99: fix host dns setting
2 parents e3de513 + ba869d7 commit 31d485b

File tree

4 files changed

+10
-7
lines changed

4 files changed

+10
-7
lines changed

logic/hosts.go

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -231,9 +231,9 @@ func CreateHost(h *models.Host) error {
231231
h.AutoUpdate = AutoUpdateEnabled()
232232

233233
if GetServerSettings().ManageDNS {
234-
h.DNS = "on"
234+
h.DNS = "yes"
235235
} else {
236-
h.DNS = "off"
236+
h.DNS = "no"
237237
}
238238
checkForZombieHosts(h)
239239
return UpsertHost(h)

logic/peers.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -163,7 +163,7 @@ func GetPeerUpdateForHost(network string, host *models.Host, allNodes []models.N
163163
HostNetworkInfo: models.HostInfoMap{},
164164
ServerConfig: GetServerInfo(),
165165
}
166-
if host.DNS == "off" {
166+
if host.DNS == "no" {
167167
hostPeerUpdate.ManageDNS = false
168168
}
169169
defer func() {

migrate/migrate.go

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -196,11 +196,11 @@ func updateHosts() {
196196
continue
197197
}
198198
}
199-
if host.DNS == "" {
199+
if host.DNS == "" || (host.DNS != "yes" && host.DNS != "no") {
200200
if logic.GetServerSettings().ManageDNS {
201-
host.DNS = "on"
201+
host.DNS = "yes"
202202
} else {
203-
host.DNS = "off"
203+
host.DNS = "no"
204204
}
205205
}
206206
}
@@ -582,5 +582,8 @@ func settings() {
582582
if settings.AuditLogsRetentionPeriodInDays == 0 {
583583
settings.AuditLogsRetentionPeriodInDays = 30
584584
}
585+
if settings.DefaultDomain == "" {
586+
settings.DefaultDomain = servercfg.GetDefaultDomain()
587+
}
585588
logic.UpsertServerSettings(settings)
586589
}

models/api_host.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -125,6 +125,6 @@ func (a *ApiHost) ConvertAPIHostToNMHost(currentHost *Host) *Host {
125125
h.TurnEndpoint = currentHost.TurnEndpoint
126126
h.PersistentKeepalive = time.Duration(a.PersistentKeepalive) * time.Second
127127
h.AutoUpdate = a.AutoUpdate
128-
h.DNS = a.DNS
128+
h.DNS = strings.ToLower(a.DNS)
129129
return &h
130130
}

0 commit comments

Comments
 (0)