Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat: Consume watch for common Writable config changes #4432

Merged
merged 1 commit into from
Mar 10, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ module github.com/edgexfoundry/edgex-go

require (
github.com/eclipse/paho.mqtt.golang v1.4.2
github.com/edgexfoundry/go-mod-bootstrap/v3 v3.0.0-dev.41
github.com/edgexfoundry/go-mod-bootstrap/v3 v3.0.0-dev.44
github.com/edgexfoundry/go-mod-configuration/v3 v3.0.0-dev.7
github.com/edgexfoundry/go-mod-core-contracts/v3 v3.0.0-dev.27
github.com/edgexfoundry/go-mod-messaging/v3 v3.0.0-dev.16
Expand Down
4 changes: 2 additions & 2 deletions go.sum
Original file line number Diff line number Diff line change
Expand Up @@ -25,8 +25,8 @@ github.com/davecgh/go-spew v1.1.1 h1:vj9j/u1bqnvCEfJOwUhtlOARqs3+rkHYY13jYWTU97c
github.com/davecgh/go-spew v1.1.1/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38=
github.com/eclipse/paho.mqtt.golang v1.4.2 h1:66wOzfUHSSI1zamx7jR6yMEI5EuHnT1G6rNA5PM12m4=
github.com/eclipse/paho.mqtt.golang v1.4.2/go.mod h1:JGt0RsEwEX+Xa/agj90YJ9d9DH2b7upDZMK9HRbFvCA=
github.com/edgexfoundry/go-mod-bootstrap/v3 v3.0.0-dev.41 h1:eBWdDMOvYHiHtG/ne3caTfVawk+j4BzkU/UW6XOMqBk=
github.com/edgexfoundry/go-mod-bootstrap/v3 v3.0.0-dev.41/go.mod h1:qiG4HABtB+mnFBOby/ZUpIWcQD0TZa8jIG7p/jeVuzc=
github.com/edgexfoundry/go-mod-bootstrap/v3 v3.0.0-dev.44 h1:bzROMV3XZzFB5uBFTeQRuqBQyHE8DJjHSl3UWoqacds=
github.com/edgexfoundry/go-mod-bootstrap/v3 v3.0.0-dev.44/go.mod h1:qiG4HABtB+mnFBOby/ZUpIWcQD0TZa8jIG7p/jeVuzc=
github.com/edgexfoundry/go-mod-configuration/v3 v3.0.0-dev.7 h1:pOH2GLDg1KB4EmAzo6IEvl4NEVFAw3ywxPUMa5Wi1Vw=
github.com/edgexfoundry/go-mod-configuration/v3 v3.0.0-dev.7/go.mod h1:ZZbOu7K0/P8B1VKhZygVujLQyhvWuPe0E2vC/k2yscw=
github.com/edgexfoundry/go-mod-core-contracts/v3 v3.0.0-dev.27 h1:lKM/NwRBL/pddoSnlXbFIlpgu+XozWbqz608EeB7S94=
Expand Down
5 changes: 5 additions & 0 deletions internal/core/command/config/config.go
Original file line number Diff line number Diff line change
Expand Up @@ -54,6 +54,11 @@ func (c *ConfigurationStruct) EmptyWritablePtr() interface{} {
return &WritableInfo{}
}

// GetWritablePtr returns pointer to the writable section
func (c *ConfigurationStruct) GetWritablePtr() any {
return &c.Writable
}

// UpdateWritableFromRaw converts configuration received from the registry to a service-specific WritableInfo struct
// which is then used to overwrite the service's existing configuration's WritableInfo struct.
func (c *ConfigurationStruct) UpdateWritableFromRaw(rawWritable interface{}) bool {
Expand Down
5 changes: 5 additions & 0 deletions internal/core/data/config/config.go
Original file line number Diff line number Diff line change
Expand Up @@ -52,6 +52,11 @@ func (c *ConfigurationStruct) EmptyWritablePtr() interface{} {
return &WritableInfo{}
}

// GetWritablePtr returns pointer to the writable section
func (c *ConfigurationStruct) GetWritablePtr() any {
return &c.Writable
}

// UpdateWritableFromRaw converts configuration received from the registry to a service-specific WritableInfo struct
// which is then used to overwrite the service's existing configuration's WritableInfo struct.
func (c *ConfigurationStruct) UpdateWritableFromRaw(rawWritable interface{}) bool {
Expand Down
5 changes: 5 additions & 0 deletions internal/core/metadata/config/config.go
Original file line number Diff line number Diff line change
Expand Up @@ -66,6 +66,11 @@ func (c *ConfigurationStruct) EmptyWritablePtr() interface{} {
return &WritableInfo{}
}

// GetWritablePtr returns pointer to the writable section
func (c *ConfigurationStruct) GetWritablePtr() any {
return &c.Writable
}

// UpdateWritableFromRaw converts configuration received from the registry to a service-specific WritableInfo struct
// which is then used to overwrite the service's existing configuration's WritableInfo struct.
func (c *ConfigurationStruct) UpdateWritableFromRaw(rawWritable interface{}) bool {
Expand Down
6 changes: 6 additions & 0 deletions internal/security/bootstrapper/config/config.go
Original file line number Diff line number Diff line change
Expand Up @@ -38,6 +38,12 @@ func (c *ConfigurationStruct) EmptyWritablePtr() interface{} {
return nil
}

// GetWritablePtr returns pointer to the writable section
// Not needed for this service, so return nil
func (c *ConfigurationStruct) GetWritablePtr() any {
return nil
}

// UpdateWritableFromRaw converts configuration received from the registry to a service-specific WritableInfo struct
// which is then used to overwrite the service's existing configuration's WritableInfo struct.
func (c *ConfigurationStruct) UpdateWritableFromRaw(rawWritable interface{}) bool {
Expand Down
6 changes: 6 additions & 0 deletions internal/security/bootstrapper/mosquitto/config/config.go
Original file line number Diff line number Diff line change
Expand Up @@ -46,6 +46,12 @@ func (c *ConfigurationStruct) EmptyWritablePtr() interface{} {
return nil
}

// GetWritablePtr returns pointer to the writable section
// Not needed for this service, so return nil
func (c *ConfigurationStruct) GetWritablePtr() any {
return nil
}

// UpdateWritableFromRaw converts configuration received from the registry to a service-specific
// WritableInfo struct which is then used to overwrite the service's existing configuration's
// WritableInfo struct.
Expand Down
6 changes: 6 additions & 0 deletions internal/security/bootstrapper/redis/config/config.go
Original file line number Diff line number Diff line change
Expand Up @@ -48,6 +48,12 @@ func (c *ConfigurationStruct) EmptyWritablePtr() interface{} {
return nil
}

// GetWritablePtr returns pointer to the writable section
// Not needed for this service, so return nil
func (c *ConfigurationStruct) GetWritablePtr() any {
return nil
}

// UpdateWritableFromRaw converts configuration received from the registry to a service-specific
// WritableInfo struct which is then used to overwrite the service's existing configuration's
// WritableInfo struct.
Expand Down
2 changes: 0 additions & 2 deletions internal/security/common/tokenpolicy_test.go
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
//
// Copyright (c) 2019-2023 Intel Corporation
//
// Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except
Expand All @@ -12,7 +11,6 @@
// the License.
//
// SPDX-License-Identifier: Apache-2.0
//
package common

import (
Expand Down
6 changes: 6 additions & 0 deletions internal/security/fileprovider/config/config.go
Original file line number Diff line number Diff line change
Expand Up @@ -56,6 +56,12 @@ func (c *ConfigurationStruct) EmptyWritablePtr() interface{} {
return nil
}

// GetWritablePtr returns pointer to the writable section
// Not needed for this service, so return nil
func (c *ConfigurationStruct) GetWritablePtr() any {
return nil
}

// UpdateWritableFromRaw converts configuration received from the registry to a service-specific WritableInfo struct
// Not needed for this service, so return false
func (c *ConfigurationStruct) UpdateWritableFromRaw(rawWritable interface{}) bool {
Expand Down
2 changes: 0 additions & 2 deletions internal/security/fileprovider/util_test.go
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
//
// Copyright (c) 2019 Intel Corporation
//
// Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except
Expand All @@ -12,7 +11,6 @@
// the License.
//
// SPDX-License-Identifier: Apache-2.0
//
package fileprovider

import (
Expand Down
5 changes: 5 additions & 0 deletions internal/security/proxyauth/config/config.go
Original file line number Diff line number Diff line change
Expand Up @@ -48,6 +48,11 @@ func (c *ConfigurationStruct) EmptyWritablePtr() interface{} {
return &WritableInfo{}
}

// GetWritablePtr returns pointer to the writable section
func (c *ConfigurationStruct) GetWritablePtr() any {
return &c.Writable
}

// UpdateWritableFromRaw converts configuration received from the registry to a service-specific WritableInfo struct
// which is then used to overwrite the service's existing configuration's WritableInfo struct.
func (c *ConfigurationStruct) UpdateWritableFromRaw(rawWritable interface{}) bool {
Expand Down
6 changes: 6 additions & 0 deletions internal/security/secretstore/config/config.go
Original file line number Diff line number Diff line change
Expand Up @@ -86,6 +86,12 @@ func (c *ConfigurationStruct) EmptyWritablePtr() interface{} {
return nil
}

// GetWritablePtr returns pointer to the writable section
// Not needed for this service, so return nil
func (c *ConfigurationStruct) GetWritablePtr() any {
return nil
}

// UpdateWritableFromRaw converts configuration received from the registry to a service-specific WritableInfo struct
// Not needed for this service, so always return false
func (c *ConfigurationStruct) UpdateWritableFromRaw(_ interface{}) bool {
Expand Down
5 changes: 5 additions & 0 deletions internal/security/spiffetokenprovider/config/config.go
Original file line number Diff line number Diff line change
Expand Up @@ -61,6 +61,11 @@ func (c *ConfigurationStruct) EmptyWritablePtr() interface{} {
return &WritableInfo{}
}

// GetWritablePtr returns pointer to the writable section
func (c *ConfigurationStruct) GetWritablePtr() any {
return &c.Writable
}

// UpdateWritableFromRaw converts configuration received from the registry to a service-specific WritableInfo struct
// which is then used to overwrite the service's existing configuration's WritableInfo struct.
func (c *ConfigurationStruct) UpdateWritableFromRaw(rawWritable interface{}) bool {
Expand Down
5 changes: 5 additions & 0 deletions internal/support/notifications/config/config.go
Original file line number Diff line number Diff line change
Expand Up @@ -81,6 +81,11 @@ func (c *ConfigurationStruct) EmptyWritablePtr() interface{} {
return &WritableInfo{}
}

// GetWritablePtr returns pointer to the writable section
func (c *ConfigurationStruct) GetWritablePtr() any {
return &c.Writable
}

// UpdateWritableFromRaw converts configuration received from the registry to a service-specific WritableInfo struct
// which is then used to overwrite the service's existing configuration's WritableInfo struct.
func (c *ConfigurationStruct) UpdateWritableFromRaw(rawWritable interface{}) bool {
Expand Down
5 changes: 5 additions & 0 deletions internal/support/scheduler/config/config.go
Original file line number Diff line number Diff line change
Expand Up @@ -112,6 +112,11 @@ func (c *ConfigurationStruct) EmptyWritablePtr() interface{} {
return &WritableInfo{}
}

// GetWritablePtr returns pointer to the writable section
func (c *ConfigurationStruct) GetWritablePtr() any {
return &c.Writable
}

// UpdateWritableFromRaw converts configuration received from the registry to a service-specific WritableInfo struct
// which is then used to overwrite the service's existing configuration's WritableInfo struct.
func (c *ConfigurationStruct) UpdateWritableFromRaw(rawWritable interface{}) bool {
Expand Down