From 19ec5807c72ea795211b836fa44cf48ef8d29680 Mon Sep 17 00:00:00 2001 From: Siggi Date: Tue, 5 Apr 2022 09:48:19 +0200 Subject: [PATCH 1/2] Added notifications config --- config/config.go | 7 +++++++ config/services.go | 5 +++++ 2 files changed, 12 insertions(+) diff --git a/config/config.go b/config/config.go index 899460eae..095b45646 100644 --- a/config/config.go +++ b/config/config.go @@ -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"` @@ -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 diff --git a/config/services.go b/config/services.go index d2ee128f9..1fbf843bd 100644 --- a/config/services.go +++ b/config/services.go @@ -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...) From 067d01c1943afcbaf3b5dc3514000984a99652a7 Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Wed, 20 Apr 2022 10:51:30 +0000 Subject: [PATCH 2/2] Bump github.com/BuxOrg/bux from 0.2.6 to 0.2.7 Bumps [github.com/BuxOrg/bux](https://github.com/BuxOrg/bux) from 0.2.6 to 0.2.7. - [Release notes](https://github.com/BuxOrg/bux/releases) - [Changelog](https://github.com/BuxOrg/bux/blob/master/.goreleaser.yml) - [Commits](https://github.com/BuxOrg/bux/compare/v0.2.6...v0.2.7) --- updated-dependencies: - dependency-name: github.com/BuxOrg/bux dependency-type: direct:production update-type: version-update:semver-patch ... Signed-off-by: dependabot[bot] --- go.mod | 9 ++++++--- go.sum | 20 +++++++++++++++----- 2 files changed, 21 insertions(+), 8 deletions(-) diff --git a/go.mod b/go.mod index 84d1860e2..1a4cefd55 100644 --- a/go.mod +++ b/go.mod @@ -4,7 +4,7 @@ go 1.17 require ( github.com/99designs/gqlgen v0.17.2 - github.com/BuxOrg/bux v0.2.6 + github.com/BuxOrg/bux v0.2.7 github.com/go-ozzo/ozzo-validation v3.6.0+incompatible github.com/go-redis/redis/v8 v8.11.5 github.com/julienschmidt/httprouter v1.3.0 @@ -66,7 +66,9 @@ require ( github.com/josharian/intern v1.0.0 // indirect github.com/jpillora/backoff v1.0.0 // indirect github.com/klauspost/compress v1.15.1 // indirect + github.com/korovkin/limiter v0.0.0-20220321204241-2880bd9cecaf // indirect github.com/kr/text v0.2.0 // indirect + github.com/libsv/go-bc v0.1.10 // indirect github.com/libsv/go-bk v0.1.6 // indirect github.com/libsv/go-bt v1.0.6 // indirect github.com/libsv/go-bt/v2 v2.1.0-beta.2.0.20211221142324-0d686850c5e0 // indirect @@ -80,7 +82,7 @@ require ( github.com/mrz1836/go-mattercloud v0.5.3 // indirect github.com/mrz1836/go-nownodes v0.0.5 // indirect github.com/mrz1836/go-parameters v0.2.8 // indirect - github.com/mrz1836/go-whatsonchain v0.10.3 // indirect + github.com/mrz1836/go-whatsonchain v0.10.4 // indirect github.com/newrelic/go-agent/v3/integrations/nrmongo v1.0.2 // indirect github.com/niemeyer/pretty v0.0.0-20200227124842-a10e7caefd8e // indirect github.com/pelletier/go-toml v1.9.4 // indirect @@ -101,6 +103,7 @@ require ( github.com/tidwall/pretty v1.2.0 // indirect github.com/tonicpow/go-minercraft v0.7.1 // indirect github.com/tonicpow/go-paymail v0.7.5 // indirect + github.com/tylertreat/BoomFilters v0.0.0-20210315201527-1a82519a3e43 // indirect github.com/ugorji/go/codec v1.2.7 // indirect github.com/valyala/bytebufferpool v1.0.0 // indirect github.com/vmihailenco/msgpack/v5 v5.3.5 // indirect @@ -113,7 +116,7 @@ require ( go.mongodb.org/mongo-driver v1.9.0 // indirect golang.org/x/crypto v0.0.0-20220411220226-7b82a4e95df4 // indirect golang.org/x/mod v0.6.0-dev.0.20220106191415-9b9b3d81d5e3 // indirect - golang.org/x/net v0.0.0-20220412020605-290c469a71a5 // indirect + golang.org/x/net v0.0.0-20220418201149-a630d4f3e7a2 // indirect golang.org/x/sync v0.0.0-20210220032951-036812b2e83c // indirect golang.org/x/sys v0.0.0-20220412211240-33da011f77ad // indirect golang.org/x/text v0.3.7 // indirect diff --git a/go.sum b/go.sum index 20991e119..2f6688b7f 100644 --- a/go.sum +++ b/go.sum @@ -56,8 +56,8 @@ github.com/99designs/gqlgen v0.17.2 h1:yczvlwMsfcVu/JtejqfrLwXuSP0yZFhmcss3caEvH github.com/99designs/gqlgen v0.17.2/go.mod h1:K5fzLKwtph+FFgh9j7nFbRUdBKvTcGnsta51fsMTn3o= github.com/BurntSushi/toml v0.3.1/go.mod h1:xHWCNGjB5oqiDr8zfno3MHue2Ht5sIBksp03qcyfWMU= github.com/BurntSushi/xgb v0.0.0-20160522181843-27f122750802/go.mod h1:IVnqGOEym/WlBOVXweHU+Q+/VP0lqqI8lqeDx9IjBqo= -github.com/BuxOrg/bux v0.2.6 h1:RaTtSntdrGTi44N6cAJ849OuVsTn0gvYtvhw8uioaes= -github.com/BuxOrg/bux v0.2.6/go.mod h1:K8eISUmIac5qt7B9x+D+iq+cvNlWDDgwL2EKdNAGX2Y= +github.com/BuxOrg/bux v0.2.7 h1:KEbH1xhQBUDm0UDX+jqf2Q7LgAXjIKS0S8S+jbXiE6w= +github.com/BuxOrg/bux v0.2.7/go.mod h1:i73KH/c78NQhKA0iD03OWLjce5YaJ9RM0GNMaYYld3s= github.com/DATA-DOG/go-sqlmock v1.5.0 h1:Shsta01QNfFxHCfpW6YH2STWB0MudeXXEWMr20OEh60= github.com/DATA-DOG/go-sqlmock v1.5.0/go.mod h1:f/Ixk793poVmq4qj/V1dPUg2JEAKC73Q5eFN3EC/SaM= github.com/DataDog/datadog-go v3.2.0+incompatible/go.mod h1:LButxg5PwREeZtORoXG3tL4fMGNddJ+vMq1mwgfaqoQ= @@ -192,6 +192,8 @@ github.com/cpuguy83/go-md2man/v2 v2.0.0-20190314233015-f79a8a8ca69d/go.mod h1:ma github.com/cpuguy83/go-md2man/v2 v2.0.1/go.mod h1:tgQtvFlXSQOSOSIRvRPT7W67SCa46tRHOmNcaadrF8o= github.com/creack/pty v1.1.7/go.mod h1:lj5s0c3V2DBrqTV7llrYr5NG6My20zk30Fl46Y7DoTY= github.com/creack/pty v1.1.9/go.mod h1:oKZEueFk5CKHvIhNR5MUki03XCEU+Q6VDXinZuGJ33E= +github.com/d4l3k/messagediff v1.2.1 h1:ZcAIMYsUg0EAp9X+tt8/enBE/Q8Yd5kzPynLyKptt9U= +github.com/d4l3k/messagediff v1.2.1/go.mod h1:Oozbb1TVXFac9FtSIxHBMnBCq2qeH/2KkEQxENCrlLo= github.com/davecgh/go-spew v0.0.0-20161028175848-04cdfd42973b/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38= github.com/davecgh/go-spew v1.1.0/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38= github.com/davecgh/go-spew v1.1.1 h1:vj9j/u1bqnvCEfJOwUhtlOARqs3+rkHYY13jYWTU97c= @@ -579,6 +581,8 @@ github.com/klauspost/cpuid/v2 v2.0.6/go.mod h1:FInQzS24/EEf25PyTYn52gqo7WaD8xa02 github.com/konsorten/go-windows-terminal-sequences v1.0.1/go.mod h1:T0+1ngSBFLxvqU3pZ+m/2kptfBszLMUkC4ZK/EgS/cQ= github.com/konsorten/go-windows-terminal-sequences v1.0.2/go.mod h1:T0+1ngSBFLxvqU3pZ+m/2kptfBszLMUkC4ZK/EgS/cQ= github.com/konsorten/go-windows-terminal-sequences v1.0.3/go.mod h1:T0+1ngSBFLxvqU3pZ+m/2kptfBszLMUkC4ZK/EgS/cQ= +github.com/korovkin/limiter v0.0.0-20220321204241-2880bd9cecaf h1:n/ZonUaZ4LAzvAcMuTXGT3MDuRM0+SXz47Hcp2rjT1c= +github.com/korovkin/limiter v0.0.0-20220321204241-2880bd9cecaf/go.mod h1:mM0lzivCxB6c8msz/LOP9lJgZxy92GXwGcNG1A7UZEE= github.com/kr/fs v0.1.0/go.mod h1:FFnZGqtBN9Gxj7eW1uZ42v5BccTP0vu6NEaFoC2HwRg= github.com/kr/logfmt v0.0.0-20140226030751-b84e30acd515/go.mod h1:+0opPa2QZZtGFBFZlji/RkVcI2GknAs/DXo4wKdlNEc= github.com/kr/pretty v0.1.0/go.mod h1:dAy3ld7l9f0ibDNOQOHHMYYIIbhfbHSm3C4ZsoJORNo= @@ -601,6 +605,8 @@ github.com/lib/pq v1.10.0/go.mod h1:AlVN5x4E4T544tWzH6hKfbfQvm3HdbOxrmggDNAPY9o= github.com/lib/pq v1.10.2/go.mod h1:AlVN5x4E4T544tWzH6hKfbfQvm3HdbOxrmggDNAPY9o= github.com/lib/pq v1.10.5 h1:J+gdV2cUmX7ZqL2B0lFcW0m+egaHC2V3lpO8nWxyYiQ= github.com/lib/pq v1.10.5/go.mod h1:AlVN5x4E4T544tWzH6hKfbfQvm3HdbOxrmggDNAPY9o= +github.com/libsv/go-bc v0.1.10 h1:pe3CriFVcHauoQSk8rJeC3/7BOgTqfp33LBb0M4SSi8= +github.com/libsv/go-bc v0.1.10/go.mod h1:55OsjWtvaIEXy4w02icUi2lIdThuwqkAiSeF4GPU5tw= github.com/libsv/go-bk v0.1.5/go.mod h1:xbDkeFFpP0uyFaPLnP6TwaLpAsHaslZ0LftTdWlB6HI= github.com/libsv/go-bk v0.1.6 h1:c9CiT5+64HRDbzxPl1v/oiFmbvWZTuUYqywCf+MBs/c= github.com/libsv/go-bk v0.1.6/go.mod h1:khJboDoH18FPUaZlzRFKzlVN84d4YfdmlDtdX4LAjQA= @@ -693,8 +699,8 @@ github.com/mrz1836/go-sanitize v1.1.5 h1:LOywG3ijK/B/D9ik3hsniyIzA1JVZlM2wmp3Q/C github.com/mrz1836/go-sanitize v1.1.5/go.mod h1:HnnbbJTcBhbr770WyRL4SA95I4FFOnGg/RTLJybsuN8= github.com/mrz1836/go-validate v0.2.0 h1:F8AcgJRW0B/hUNFAXijrN/EGqYlAIkIIpMDkIMMRUho= github.com/mrz1836/go-validate v0.2.0/go.mod h1:IoGAb4rTAL6KgAxOiWL4ICwLqxGbKCKT1GyaSuE/4bk= -github.com/mrz1836/go-whatsonchain v0.10.3 h1:hY1GnEaeXIp+j/Q+nC8mcKPflWGtWQ++5mhHuFBRvxo= -github.com/mrz1836/go-whatsonchain v0.10.3/go.mod h1:eTHXB8rB3R2pT+opTGS7taY6vzHUzgoRrd+dzAxyuWM= +github.com/mrz1836/go-whatsonchain v0.10.4 h1:reZbJ2HlnwQmfB4cKcDAzZ9QTrUbk3AhiIGng+Hny3M= +github.com/mrz1836/go-whatsonchain v0.10.4/go.mod h1:JuGpqX7Y/QWNkqgkn9gW2yJ2wtUMzzaC8BDTEoaEz6A= github.com/mwitkow/go-conntrack v0.0.0-20161129095857-cc309e4a2223/go.mod h1:qRWi+5nqEBWmkhHvq77mSJWrCKwh8bxhgT7d/eI7P4U= github.com/mwitkow/go-conntrack v0.0.0-20190716064945-2f068394615f/go.mod h1:qRWi+5nqEBWmkhHvq77mSJWrCKwh8bxhgT7d/eI7P4U= github.com/nats-io/jwt v0.3.0/go.mod h1:fRYCDE99xlTsqUzISS1Bi75UBJ6ljOJQOAAu5VglpSg= @@ -861,6 +867,7 @@ github.com/smartystreets/goconvey v1.6.4/go.mod h1:syvi0/a8iFYH4r/RixwvyeAJjdLS9 github.com/soheilhy/cmux v0.1.4/go.mod h1:IM3LyeVVIOuxMH7sFAkER9+bJ4dT7Ms6E4xg4kGIyLM= github.com/sony/gobreaker v0.4.1/go.mod h1:ZKptC7FHNvhBz7dN2LGjPVBz2sZJmc0/PkyDJOjmxWY= github.com/spaolacci/murmur3 v0.0.0-20180118202830-f09979ecbc72/go.mod h1:JwIasOWyU6f++ZhiEuf87xNszmSA2myDM2Kzu9HwQUA= +github.com/spaolacci/murmur3 v1.1.0/go.mod h1:JwIasOWyU6f++ZhiEuf87xNszmSA2myDM2Kzu9HwQUA= github.com/spf13/afero v1.6.0/go.mod h1:Ai8FlHk4v/PARR026UzYexafAt9roJ7LcLMAmO6Z93I= github.com/spf13/afero v1.8.2 h1:xehSyVa0YnHWsJ49JFljMpg1HX19V6NDZ1fkm1Xznbo= github.com/spf13/afero v1.8.2/go.mod h1:CtAatgMJh6bJEIs48Ay/FOnkljP3WeGUG0MC1RfAqwo= @@ -914,6 +921,8 @@ github.com/tonicpow/go-paymail v0.7.5/go.mod h1:YtNTj6gJQ7+CjrjIotk6iJOf2be1zch6 github.com/tryvium-travels/memongo v0.5.0 h1:Snai8FKpLWs23+IIXLJl99u+mFqz7kZBkrP6M7H1cAA= github.com/tryvium-travels/memongo v0.5.0/go.mod h1:TKLvXhrZIqe1meEsWofcM6EmWawRdhFRGazUhiYsaUM= github.com/tv42/httpunix v0.0.0-20150427012821-b75d8614f926/go.mod h1:9ESjWnEqriFuLhtthL60Sar/7RFoluCcXsuvEwTV5KM= +github.com/tylertreat/BoomFilters v0.0.0-20210315201527-1a82519a3e43 h1:QEePdg0ty2r0t1+qwfZmQ4OOl/MB2UXIeJSpIZv56lg= +github.com/tylertreat/BoomFilters v0.0.0-20210315201527-1a82519a3e43/go.mod h1:OYRfF6eb5wY9VRFkXJH8FFBi3plw2v+giaIu7P054pM= github.com/ugorji/go v1.2.6/go.mod h1:anCg0y61KIhDlPZmnH+so+RQbysYVyDko0IMgJv0Nn0= github.com/ugorji/go v1.2.7 h1:qYhyWUUd6WbiM+C6JZAUkIJt/1WrjzNHY9+KCIjVqTo= github.com/ugorji/go v1.2.7/go.mod h1:nF9osbDWLy6bDVv/Rtoh6QgnvNDpmCalQV5urGCCS6M= @@ -1138,8 +1147,9 @@ golang.org/x/net v0.0.0-20220127200216-cd36cc0744dd/go.mod h1:CfG3xpIq0wQ8r1q4Su golang.org/x/net v0.0.0-20220225172249-27dd8689420f/go.mod h1:CfG3xpIq0wQ8r1q4Su4UZFWDARRcnwPjda9FqA0JpMk= golang.org/x/net v0.0.0-20220325170049-de3da57026de/go.mod h1:CfG3xpIq0wQ8r1q4Su4UZFWDARRcnwPjda9FqA0JpMk= golang.org/x/net v0.0.0-20220403103023-749bd193bc2b/go.mod h1:CfG3xpIq0wQ8r1q4Su4UZFWDARRcnwPjda9FqA0JpMk= -golang.org/x/net v0.0.0-20220412020605-290c469a71a5 h1:bRb386wvrE+oBNdF1d/Xh9mQrfQ4ecYhW5qJ5GvTGT4= golang.org/x/net v0.0.0-20220412020605-290c469a71a5/go.mod h1:CfG3xpIq0wQ8r1q4Su4UZFWDARRcnwPjda9FqA0JpMk= +golang.org/x/net v0.0.0-20220418201149-a630d4f3e7a2 h1:6mzvA99KwZxbOrxww4EvWVQUnN1+xEu9tafK5ZxkYeA= +golang.org/x/net v0.0.0-20220418201149-a630d4f3e7a2/go.mod h1:CfG3xpIq0wQ8r1q4Su4UZFWDARRcnwPjda9FqA0JpMk= golang.org/x/oauth2 v0.0.0-20180821212333-d2e6202438be/go.mod h1:N/0e6XlmueqKjAGxoOufVs8QHGRruUQn6yWY3a++T0U= golang.org/x/oauth2 v0.0.0-20190226205417-e64efc72b421/go.mod h1:gOpvHmFTYa4IltrdGE7lF6nIHvwfUNPOp7c8zoXwtLw= golang.org/x/oauth2 v0.0.0-20190604053449-0f29369cfe45/go.mod h1:gOpvHmFTYa4IltrdGE7lF6nIHvwfUNPOp7c8zoXwtLw=