Move dns label generation to store (#552)

This commit is contained in:
Maycon Santos 2022-11-08 10:31:34 +01:00 committed by GitHub
parent a768a0aa8a
commit 7e262572a4
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 6 additions and 6 deletions

View File

@ -384,12 +384,6 @@ func BuildManager(store Store, peersUpdateManager *PeersUpdateManager, idpManage
shouldSave = true shouldSave = true
} }
existingLabels := account.getPeerDNSLabels()
if len(existingLabels) != len(account.Peers) {
addPeerLabelsToAccount(account, existingLabels)
shouldSave = true
}
if shouldSave { if shouldSave {
err = store.SaveAccount(account) err = store.SaveAccount(account)
if err != nil { if err != nil {

View File

@ -101,6 +101,12 @@ func restore(file string) (*FileStore, error) {
account.IsDomainPrimaryAccount { account.IsDomainPrimaryAccount {
store.PrivateDomain2AccountID[account.Domain] = accountID store.PrivateDomain2AccountID[account.Domain] = accountID
} }
// for data migration. Can be removed once most base will be with labels
existingLabels := account.getPeerDNSLabels()
if len(existingLabels) != len(account.Peers) {
addPeerLabelsToAccount(account, existingLabels)
}
} }
// we need this persist to apply changes we made to account.Peers (we set them to Disconnected) // we need this persist to apply changes we made to account.Peers (we set them to Disconnected)