Skip to content

Commit

Permalink
Merge branch 'master' into siggi/graphql-logging
Browse files Browse the repository at this point in the history
  • Loading branch information
mrz1836 authored Apr 20, 2022
2 parents 1b11404 + 1642b24 commit 507cb6e
Show file tree
Hide file tree
Showing 4 changed files with 33 additions and 6 deletions.
7 changes: 7 additions & 0 deletions config/config.go
Original file line number Diff line number Diff line change
Expand Up @@ -56,6 +56,7 @@ type (
GraphQL *GraphqlConfig `json:"graphql" mapstructure:"graphql"`
Mongo *datastore.MongoDBConfig `json:"mongodb" mapstructure:"mongodb"`
NewRelic *NewRelicConfig `json:"new_relic" mapstructure:"new_relic"`
Notifications *NotificationsConfig `json:"notifications" mapstructure:"notifications"`
Paymail *PaymailConfig `json:"paymail" mapstructure:"paymail"`
Redis *RedisConfig `json:"redis" mapstructure:"redis"`
RequestLogging bool `json:"request_logging" mapstructure:"request_logging"`
Expand Down Expand Up @@ -101,6 +102,12 @@ type (
LicenseKey string `json:"license_key" mapstructure:"license_key"` // 2342-3423523-62
}

// NotificationsConfig is the configuration for notifications
NotificationsConfig struct {
Enabled bool `json:"enabled" mapstructure:"enabled"` // true/false
WebhookEndpoint string `json:"webhook_endpoint" mapstructure:"webhook_endpoint"`
}

// PaymailConfig is the configuration for the built-in Paymail server
PaymailConfig struct {
DefaultFromPaymail string `json:"default_from_paymail" mapstructure:"default_from_paymail"` // IE: from@domain.com
Expand Down
5 changes: 5 additions & 0 deletions config/services.go
Original file line number Diff line number Diff line change
Expand Up @@ -198,6 +198,11 @@ func (s *AppServices) loadBux(ctx context.Context, appConfig *AppConfig) (err er
}
}

if appConfig.Notifications != nil && appConfig.Notifications.Enabled {
// configure the default notification handler
options = append(options, bux.WithNotifications(appConfig.Notifications.WebhookEndpoint))
}

// Create the new client
s.Bux, err = bux.NewClient(ctx, options...)

Expand Down
9 changes: 6 additions & 3 deletions go.mod

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

18 changes: 15 additions & 3 deletions go.sum

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

0 comments on commit 507cb6e

Please sign in to comment.