diff --git a/lib/service/config.go b/lib/service/config.go index 61e5f80..f767522 100644 --- a/lib/service/config.go +++ b/lib/service/config.go @@ -17,4 +17,5 @@ type Config struct { BurstRateLimit int `envconfig:"BURST_RATE_LIMIT" default:"1"` EnablePrometheus bool `envconfig:"ENABLE_PROMETHEUS" default:"false"` PrometheusPort int `envconfig:"PROMETHEUS_PORT" default:"9092"` + WebhookUrl string `envconfig:"WEBHOOK_URL"` } diff --git a/main.go b/main.go index 25e072b..3219453 100644 --- a/main.go +++ b/main.go @@ -168,6 +168,13 @@ func main() { // Subscribe to LND invoice updates in the background go svc.InvoiceUpdateSubscription(context.Background()) + //Start webhook subscription + if svc.Config.WebhookUrl != "" { + webhookCtx, cancelWebhook := context.WithCancel(context.Background()) + go svc.StartWebhookSubscribtion(webhookCtx) + defer cancelWebhook() + } + //Start Prometheus server if necessary var echoPrometheus *echo.Echo if svc.Config.EnablePrometheus {