diff --git a/pkg/async/notifications/factory.go b/pkg/async/notifications/factory.go index 702145d4b..ad0b4b311 100644 --- a/pkg/async/notifications/factory.go +++ b/pkg/async/notifications/factory.go @@ -95,7 +95,11 @@ func NewNotificationsPublisher(config runtimeInterfaces.NotificationsConfig, sco snsConfig := gizmoAWS.SNSConfig{ Topic: config.NotificationsPublisherConfig.TopicName, } - snsConfig.Region = config.Region + if config.AWSConfig.Region != "" { + snsConfig.Region = config.AWSConfig.Region + } else { + snsConfig.Region = config.Region + } publisher, err := gizmoAWS.NewPublisher(snsConfig) // Any errors initiating Publisher with Amazon configurations results in a failed start up. if err != nil { @@ -106,7 +110,7 @@ func NewNotificationsPublisher(config runtimeInterfaces.NotificationsConfig, sco pubsubConfig := gizmoGCP.Config{ Topic: config.NotificationsPublisherConfig.TopicName, } - pubsubConfig.ProjectID = config.ProjectID + pubsubConfig.ProjectID = config.GCPConfig.ProjectID publisher, err := gizmoGCP.NewPublisher(context.TODO(), pubsubConfig) if err != nil { panic(err) diff --git a/pkg/runtime/interfaces/application_configuration.go b/pkg/runtime/interfaces/application_configuration.go index 6edabe530..2e1f1932e 100644 --- a/pkg/runtime/interfaces/application_configuration.go +++ b/pkg/runtime/interfaces/application_configuration.go @@ -47,6 +47,16 @@ type ApplicationConfig struct { MetadataStoragePrefix []string `json:"metadataStoragePrefix"` } +// This section holds common config for AWS +type AWSConfig struct { + Region string `json:"region"` +} + +// This section holds common config for GCP +type GCPConfig struct { + ProjectID string `json:"projectId"` +} + // This section holds configuration for the event scheduler used to schedule workflow executions. type EventSchedulerConfig struct { // Defines the cloud provider that backs the scheduler. In the absence of a specification the no-op, 'local' @@ -128,10 +138,10 @@ type NotificationsConfig struct { // Defines the cloud provider that backs the scheduler. In the absence of a specification the no-op, 'local' // scheme is used. Type string `json:"type"` - // Some cloud providers require a region to be set. - Region string `json:"region"` - // Some cloud providers require a project ID to be set. - ProjectID string `json:"projectId"` + // Deprecated: Please use AWSConfig instead. + Region string `json:"region"` + AWSConfig AWSConfig `json:"aws"` + GCPConfig GCPConfig `json:"gcp"` NotificationsPublisherConfig NotificationsPublisherConfig `json:"publisher"` NotificationsProcessorConfig NotificationsProcessorConfig `json:"processor"` NotificationsEmailerConfig NotificationsEmailerConfig `json:"emailer"`