Commit 10fd53d6 authored by poornas's avatar poornas Committed by GitHub

Fix: admin config set API for notifications (#9085)

Filter out targets set via env when
validating incoming config change against
configured notification targets

Fixes #9066
parent 3fea1d5e
......@@ -428,6 +428,10 @@ func lookupConfigs(s config.Config) {
if err != nil {
logger.LogIf(ctx, fmt.Errorf("Unable to initialize notification target(s): %w", err))
}
globalEnvTargetList, err = notify.GetNotificationTargets(newServerConfig(), GlobalServiceDoneCh, NewCustomHTTPTransport())
if err != nil {
logger.LogIf(ctx, fmt.Errorf("Unable to initialize notification target(s): %w", err))
}
}
// Help - return sub-system level help
......
......@@ -144,8 +144,11 @@ var (
globalNotificationSys *NotificationSys
globalConfigTargetList *event.TargetList
globalPolicySys *PolicySys
globalIAMSys *IAMSys
// globalEnvTargetList has list of targets configured via env.
globalEnvTargetList *event.TargetList
globalPolicySys *PolicySys
globalIAMSys *IAMSys
globalLifecycleSys *LifecycleSys
globalBucketSSEConfigSys *BucketSSEConfigSys
......
......@@ -757,8 +757,14 @@ func (sys *NotificationSys) ConfiguredTargetIDs() []event.TargetID {
}
}
}
return targetIDs
// Filter out targets configured via env
var tIDs []event.TargetID
for _, targetID := range targetIDs {
if !globalEnvTargetList.Exists(targetID) {
tIDs = append(tIDs, targetID)
}
}
return tIDs
}
// RemoveNotification - removes all notification configuration for bucket name.
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment