diff --git a/cmd/core-command/res/configuration.toml b/cmd/core-command/res/configuration.toml index 5e4758acea..f226617904 100644 --- a/cmd/core-command/res/configuration.toml +++ b/cmd/core-command/res/configuration.toml @@ -24,7 +24,7 @@ Port = 8500 Type = 'consul' [Clients] - [Clients.Metadata] + [Clients.edgex-core-metadata] Protocol = 'http' Host = 'localhost' Port = 48081 diff --git a/cmd/core-data/res/configuration.toml b/cmd/core-data/res/configuration.toml index 3cd54e47b6..027e361123 100644 --- a/cmd/core-data/res/configuration.toml +++ b/cmd/core-data/res/configuration.toml @@ -30,7 +30,7 @@ Port = 8500 Type = 'consul' [Clients] - [Clients.Metadata] + [Clients.edgex-core-metadata] Protocol = 'http' Host = 'localhost' Port = 48081 diff --git a/cmd/core-metadata/res/configuration.toml b/cmd/core-metadata/res/configuration.toml index 529d0fd034..998f2ca530 100644 --- a/cmd/core-metadata/res/configuration.toml +++ b/cmd/core-metadata/res/configuration.toml @@ -26,11 +26,11 @@ Type = 'consul' [Clients] - [Clients.Notifications] + [Clients.edgex-support-notifications] Protocol = 'http' Host = 'localhost' Port = 48060 - [Clients.CoreData] + [Clients.edgex-core-data] Protocol = 'http' Host = 'localhost' Port = 48080 diff --git a/cmd/sys-mgmt-agent/res/configuration.toml b/cmd/sys-mgmt-agent/res/configuration.toml index 59446e5891..aebbe77bf0 100644 --- a/cmd/sys-mgmt-agent/res/configuration.toml +++ b/cmd/sys-mgmt-agent/res/configuration.toml @@ -33,27 +33,27 @@ Port = 8500 Type = 'consul' [Clients] - [Clients.Notifications] + [Clients.edgex-support-notifications] Protocol = 'http' Host = 'localhost' Port = 48060 - [Clients.Command] + [Clients.edgex-core-command] Protocol = 'http' Host = 'localhost' Port = 48082 - [Clients.Metadata] + [Clients.edgex-core-metadata] Protocol = 'http' Host = 'localhost' Port = 48081 - [Clients.CoreData] + [Clients.edgex-core-data] Protocol = 'http' Host = 'localhost' Port = 48080 - [Clients.Scheduler] + [Clients.edgex-support-scheduler] Protocol = 'http' Host = 'localhost' Port = 48085 diff --git a/go.mod b/go.mod index 42b43361c0..38da873186 100644 --- a/go.mod +++ b/go.mod @@ -7,7 +7,7 @@ require ( github.com/dgrijalva/jwt-go v3.2.0+incompatible github.com/edgexfoundry/go-mod-bootstrap/v2 v2.0.0-dev.13 github.com/edgexfoundry/go-mod-configuration/v2 v2.0.0-dev.3 - github.com/edgexfoundry/go-mod-core-contracts/v2 v2.0.0-dev.38 + github.com/edgexfoundry/go-mod-core-contracts/v2 v2.0.0-dev.39 github.com/edgexfoundry/go-mod-messaging/v2 v2.0.0-dev.3 github.com/edgexfoundry/go-mod-registry/v2 v2.0.0-dev.3 github.com/edgexfoundry/go-mod-secrets/v2 v2.0.0-dev.7 diff --git a/internal/core/command/init.go b/internal/core/command/init.go index bc5da2fe18..6ae74ccd48 100644 --- a/internal/core/command/init.go +++ b/internal/core/command/init.go @@ -66,19 +66,19 @@ func (b *Bootstrap) BootstrapHandler(ctx context.Context, wg *sync.WaitGroup, _ // initialize clients required by the service dic.Update(di.ServiceConstructorMap{ container.MetadataDeviceClientName: func(get di.Get) interface{} { - return metadata.NewDeviceClient(local.New(configuration.Clients["Metadata"].Url() + clients.ApiDeviceRoute)) + return metadata.NewDeviceClient(local.New(configuration.Clients[clients.CoreMetaDataServiceKey].Url() + clients.ApiDeviceRoute)) }, errorContainer.ErrorHandlerName: func(get di.Get) interface{} { return errorconcept.NewErrorHandler(lc) }, V2Container.MetadataDeviceClientName: func(get di.Get) interface{} { // add v2 API MetadataDeviceClient - return V2Clients.NewDeviceClient(configuration.Clients["Metadata"].Url() + V2Routes.ApiDeviceRoute) + return V2Clients.NewDeviceClient(configuration.Clients[clients.CoreMetaDataServiceKey].Url() + V2Routes.ApiDeviceRoute) }, V2Container.MetadataDeviceProfileClientName: func(get di.Get) interface{} { // add v2 API MetadataDeviceProfileClient - return V2Clients.NewDeviceProfileClient(configuration.Clients["Metadata"].Url() + V2Routes.ApiDeviceProfileRoute) + return V2Clients.NewDeviceProfileClient(configuration.Clients[clients.CoreMetaDataServiceKey].Url() + V2Routes.ApiDeviceProfileRoute) }, V2Container.MetadataDeviceServiceClientName: func(get di.Get) interface{} { // add v2 API MetadataDeviceServiceClient - return V2Clients.NewDeviceServiceClient(configuration.Clients["Metadata"].Url() + V2Routes.ApiDeviceServiceRoute) + return V2Clients.NewDeviceServiceClient(configuration.Clients[clients.CoreMetaDataServiceKey].Url() + V2Routes.ApiDeviceServiceRoute) }, V2Container.DeviceServiceCommandClientName: func(get di.Get) interface{} { // add v2 API DeviceServiceCommandClient return V2Clients.NewDeviceServiceCommandClient() diff --git a/internal/core/data/init.go b/internal/core/data/init.go index ed6becb1a7..41d106cc0a 100644 --- a/internal/core/data/init.go +++ b/internal/core/data/init.go @@ -31,6 +31,7 @@ import ( "github.com/edgexfoundry/go-mod-core-contracts/v2/clients" "github.com/edgexfoundry/go-mod-core-contracts/v2/clients/metadata" "github.com/edgexfoundry/go-mod-core-contracts/v2/clients/urlclient/local" + contractsV2 "github.com/edgexfoundry/go-mod-core-contracts/v2/v2" "github.com/edgexfoundry/go-mod-messaging/v2/messaging" msgTypes "github.com/edgexfoundry/go-mod-messaging/v2/pkg/types" @@ -57,21 +58,21 @@ func (b *Bootstrap) BootstrapHandler(ctx context.Context, wg *sync.WaitGroup, st configuration := dataContainer.ConfigurationFrom(dic.Get) lc := container.LoggingClientFrom(dic.Get) - mdc := metadata.NewDeviceClient(local.New(configuration.Clients["Metadata"].Url() + clients.ApiDeviceRoute)) - msc := metadata.NewDeviceServiceClient(local.New(configuration.Clients["Metadata"].Url() + clients.ApiDeviceRoute)) + mdc := metadata.NewDeviceClient(local.New(configuration.Clients[clients.CoreMetaDataServiceKey].Url() + clients.ApiDeviceRoute)) + msc := metadata.NewDeviceServiceClient(local.New(configuration.Clients[clients.CoreMetaDataServiceKey].Url() + clients.ApiDeviceRoute)) // For Redis Streams MessageBus, we reuse the Redis instance running for the DB, which may have a password, // so we need to get and use the DB credentials for the MessageBus connection. if configuration.MessageQueue.Type == "redisstreams" { secretProvider := container.SecretProviderFrom(dic.Get) - credentials, err := secretProvider.GetSecrets(configuration.Databases["Primary"].Type) + credentials, err := secretProvider.GetSecrets(configuration.Databases[contractsV2.Primary].Type) if err != nil { lc.Error(fmt.Sprintf("Error getting DB creds for RedisStreams: %s", err.Error())) return false } lc.Info("DB Credentials set for using Redis Streams") - configuration.MessageQueue.Optional["Password"] = credentials[secret.PasswordKey] + configuration.MessageQueue.Optional[contractsV2.Password] = credentials[secret.PasswordKey] } // Create the messaging client diff --git a/internal/core/metadata/init.go b/internal/core/metadata/init.go index 521bb415e7..4c63e29eef 100644 --- a/internal/core/metadata/init.go +++ b/internal/core/metadata/init.go @@ -69,11 +69,11 @@ func (b *Bootstrap) BootstrapHandler(ctx context.Context, wg *sync.WaitGroup, _ }, container.CoreDataValueDescriptorClientName: func(get di.Get) interface{} { return coredata.NewValueDescriptorClient( - local.New(configuration.Clients["CoreData"].Url() + clients.ApiValueDescriptorRoute)) + local.New(configuration.Clients[clients.CoreDataServiceKey].Url() + clients.ApiValueDescriptorRoute)) }, container.NotificationsClientName: func(get di.Get) interface{} { return notifications.NewNotificationsClient( - local.New(configuration.Clients["Notifications"].Url() + clients.ApiNotificationRoute)) + local.New(configuration.Clients[clients.SupportNotificationsServiceKey].Url() + clients.ApiNotificationRoute)) }, }) diff --git a/internal/pkg/bootstrap/handlers/database/database.go b/internal/pkg/bootstrap/handlers/database/database.go index ea12c26448..bb2bf7feab 100644 --- a/internal/pkg/bootstrap/handlers/database/database.go +++ b/internal/pkg/bootstrap/handlers/database/database.go @@ -33,6 +33,7 @@ import ( "github.com/edgexfoundry/go-mod-bootstrap/v2/di" "github.com/edgexfoundry/go-mod-core-contracts/v2/clients/logger" + "github.com/edgexfoundry/go-mod-core-contracts/v2/v2" ) // httpServer defines the contract used to determine whether or not the http httpServer is running. @@ -70,7 +71,7 @@ func (d Database) newDBClient( lc logger.LoggingClient, credentials bootstrapConfig.Credentials) (dbInterfaces.DBClient, error) { - databaseInfo := d.database.GetDatabaseInfo()["Primary"] + databaseInfo := d.database.GetDatabaseInfo()[v2.Primary] switch databaseInfo.Type { case db.RedisDB: conf := db.Configuration{ @@ -103,7 +104,7 @@ func (d Database) BootstrapHandler( for startupTimer.HasNotElapsed() { var err error - secrets, err := secretProvider.GetSecrets(d.database.GetDatabaseInfo()["Primary"].Type) + secrets, err := secretProvider.GetSecrets(d.database.GetDatabaseInfo()[v2.Primary].Type) if err == nil { credentials = bootstrapConfig.Credentials{ Username: secrets[secret.UsernameKey], diff --git a/internal/pkg/v2/bootstrap/handlers/database.go b/internal/pkg/v2/bootstrap/handlers/database.go index 76e380e6ee..5b4553f372 100644 --- a/internal/pkg/v2/bootstrap/handlers/database.go +++ b/internal/pkg/v2/bootstrap/handlers/database.go @@ -15,13 +15,14 @@ import ( "github.com/edgexfoundry/edgex-go/internal/pkg/db" "github.com/edgexfoundry/edgex-go/internal/pkg/v2/infrastructure/redis" v2Interface "github.com/edgexfoundry/edgex-go/internal/pkg/v2/interfaces" + bootstrapContainer "github.com/edgexfoundry/go-mod-bootstrap/v2/bootstrap/container" "github.com/edgexfoundry/go-mod-bootstrap/v2/bootstrap/secret" "github.com/edgexfoundry/go-mod-bootstrap/v2/bootstrap/startup" bootstrapConfig "github.com/edgexfoundry/go-mod-bootstrap/v2/config" "github.com/edgexfoundry/go-mod-bootstrap/v2/di" - "github.com/edgexfoundry/go-mod-core-contracts/v2/clients/logger" + "github.com/edgexfoundry/go-mod-core-contracts/v2/v2" ) // httpServer defines the contract used to determine whether or not the http httpServer is running. @@ -49,7 +50,7 @@ func NewDatabase(httpServer httpServer, database interfaces.Database, dBClientIn func (d Database) newDBClient( lc logger.LoggingClient, credentials bootstrapConfig.Credentials) (v2Interface.DBClient, error) { - databaseInfo := d.database.GetDatabaseInfo()["Primary"] + databaseInfo := d.database.GetDatabaseInfo()[v2.Primary] switch databaseInfo.Type { case "redisdb": return redis.NewClient( @@ -78,7 +79,7 @@ func (d Database) BootstrapHandler( for startupTimer.HasNotElapsed() { var err error - secrets, err := secretProvider.GetSecrets(d.database.GetDatabaseInfo()["Primary"].Type) + secrets, err := secretProvider.GetSecrets(d.database.GetDatabaseInfo()[v2.Primary].Type) if err == nil { credentials = bootstrapConfig.Credentials{ Username: secrets[secret.UsernameKey], diff --git a/internal/security/bootstrapper/redis/handlers/handlers.go b/internal/security/bootstrapper/redis/handlers/handlers.go index 5dcd549df0..02d6c6f74f 100644 --- a/internal/security/bootstrapper/redis/handlers/handlers.go +++ b/internal/security/bootstrapper/redis/handlers/handlers.go @@ -33,6 +33,7 @@ import ( bootstrapConfig "github.com/edgexfoundry/go-mod-bootstrap/v2/config" "github.com/edgexfoundry/go-mod-bootstrap/v2/di" "github.com/edgexfoundry/go-mod-core-contracts/v2/clients/logger" + "github.com/edgexfoundry/go-mod-core-contracts/v2/v2" ) const ( @@ -67,7 +68,7 @@ func (handler *Handler) GetCredentials(ctx context.Context, _ *sync.WaitGroup, s for startupTimer.HasNotElapsed() { // retrieve database credentials from secretstore - secrets, err := secretProvider.GetSecrets(config.Databases["Primary"].Type) + secrets, err := secretProvider.GetSecrets(config.Databases[v2.Primary].Type) if err == nil { credentials.Username = secrets[secret.UsernameKey] credentials.Password = secrets[secret.PasswordKey] diff --git a/internal/support/notifications/v2/controller/http/subscription_test.go b/internal/support/notifications/v2/controller/http/subscription_test.go index 5a05abdc4a..4467b7d8d4 100644 --- a/internal/support/notifications/v2/controller/http/subscription_test.go +++ b/internal/support/notifications/v2/controller/http/subscription_test.go @@ -50,7 +50,6 @@ var ( testSubscriptionResendLimit = int64(5) testSubscriptionResendInterval = "10s" unsupportedChannelType = "unsupportedChannelType" - unsupportedCategory = "unsupportedCategory" ) func mockDic() *di.Container {