Skip to content
This repository has been archived by the owner on Oct 9, 2023. It is now read-only.

Commit

Permalink
Merge pull request #1 from honnix/aws-gcp-config
Browse files Browse the repository at this point in the history
have dedicated config sections for aws and gcp
  • Loading branch information
honnix authored Apr 22, 2020
2 parents 104b264 + c7efb81 commit c9ecc93
Show file tree
Hide file tree
Showing 2 changed files with 20 additions and 6 deletions.
8 changes: 6 additions & 2 deletions pkg/async/notifications/factory.go
Original file line number Diff line number Diff line change
Expand Up @@ -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 {
Expand All @@ -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)
Expand Down
18 changes: 14 additions & 4 deletions pkg/runtime/interfaces/application_configuration.go
Original file line number Diff line number Diff line change
Expand Up @@ -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'
Expand Down Expand Up @@ -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"`
Expand Down

0 comments on commit c9ecc93

Please sign in to comment.