Skip to content

applyWritableUpdates cannot handle deleted config keys #877

@FelixTing

Description

@FelixTing

🚀 Feature Request

Relevant Package [REQUIRED]

This feature request is for EdgeX services

Description [REQUIRED]

func (cp *Processor) applyWritableUpdates(serviceConfig interfaces.Configuration, raw any) {
lc := cp.lc
previousLogLevel := serviceConfig.GetLogLevel()
previousTelemetryInterval := serviceConfig.GetTelemetryInfo().Interval
var previousInsecureSecrets config.InsecureSecrets
if err := utils.DeepCopy(serviceConfig.GetInsecureSecrets(), &previousInsecureSecrets); err != nil {
lc.Errorf("failed to deep copy insecure secrets: %v", err)
}
if err := utils.MergeValues(serviceConfig.GetWritablePtr(), raw); err != nil {
lc.Errorf("failed to apply Writable change to service configuration: %v", err)
}

Processor.applyWritableUpdates uses utils.MergeValues to apply updates to the writable portion of the service configuration. However, MergeValues only updates or adds fields but cannot remove keys that no longer exist in the upstream configuration provider. This means if a writable config entry (e.g., an insecure secret) is removed from the config provider, it will remain in the local service configuration.

Describe the solution you'd like

Replace the MergeValues approach with a full reload

Metadata

Metadata

Assignees

Labels

enhancementNew feature or request

Type

No type

Projects

Status

Palau Done

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions