Fix immediate profile application, update endpoint domain syntax

This commit is contained in:
Daniel
2019-03-18 16:29:00 +01:00
parent eea7be8f15
commit 046dd9b5ad
9 changed files with 110 additions and 39 deletions

View File

@@ -10,7 +10,7 @@ import (
)
func initUpdateListener() error {
sub, err := profileDB.Subscribe(query.New(MakeProfileKey(SpecialNamespace, "")))
sub, err := profileDB.Subscribe(query.New("core:profiles/"))
if err != nil {
return err
}
@@ -36,34 +36,40 @@ func updateListener(sub *database.Subscription) {
continue
}
log.Infof("profile: updated %s", profile.ID)
switch profile.DatabaseKey() {
case "profiles/special/global":
specialProfileLock.Lock()
globalProfile = profile
specialProfileLock.Unlock()
case "profiles/special/fallback":
profile.Lock()
if ensureServiceEndpointsDenyAll(profile) {
profile.Unlock()
profileChanged := ensureServiceEndpointsDenyAll(profile)
profile.Unlock()
if profileChanged {
profile.Save(SpecialNamespace)
continue
}
profile.Unlock()
specialProfileLock.Lock()
fallbackProfile = profile
specialProfileLock.Unlock()
default:
switch {
case strings.HasPrefix(profile.Key(), MakeProfileKey(UserNamespace, "")):
updateActiveUserProfile(profile)
increaseUpdateVersion()
updateActiveProfile(profile, true /* User Profile */)
case strings.HasPrefix(profile.Key(), MakeProfileKey(StampNamespace, "")):
updateActiveStampProfile(profile)
increaseUpdateVersion()
updateActiveProfile(profile, false /* Stamp Profile */)
}
}
}
}
}
}