This repository has no description
0

Configure Feed

Select the types of activity you want to include in your feed.

feat(config): make nats url configurable

+7 -5
+1
config.go
··· 14 14 type Configuration struct { 15 15 ChurrosDatabaseURL string `env:"DATABASE_URL"` 16 16 RedisURL string `env:"REDIS_URL"` 17 + NatsURL string `env:"NATS_URL" envDefault:"nats://localhost:4222"` 17 18 VapidPublicKey string `env:"PUBLIC_VAPID_KEY"` 18 19 VapidPrivateKey string `env:"VAPID_PRIVATE_KEY"` 19 20 ContactEmail string `env:"CONTACT_EMAIL"`
+2 -2
health.go
··· 74 74 } 75 75 76 76 func CheckNATSHealth() error { 77 - nc, err := nats.Connect(nats.DefaultURL) 77 + nc, err := nats.Connect(config.NatsURL) 78 78 if err != nil { 79 - return fmt.Errorf("could not connect to NATS at %s: %w", nats.DefaultURL, err) 79 + return fmt.Errorf("could not connect to NATS at %s: %w", config.NatsURL, err) 80 80 } 81 81 82 82 _, err = nc.JetStream()
+4 -3
server/main.go
··· 29 29 ll.Info("Running with config ") 30 30 ll.Log("", "reset", "Schedule recovery: [bold][dim]at startup [reset][bold]%s[reset]", config.StartupScheduleRestoration) 31 31 ll.Log("", "reset", "contact email: [bold]%s[reset]", config.ContactEmail) 32 + ll.Log("", "reset", "NATS URL: [bold]%s[reset]", redactURL(config.NatsURL)) 32 33 ll.Log("", "reset", "Churros DB URL: [bold]%s[reset]", redactURL(config.ChurrosDatabaseURL)) 33 34 ll.Log("", "reset", "Redis URL: [bold]%s[reset]", redactURL(config.RedisURL)) 34 35 ll.Log("", "reset", "Health check on: [bold]:%d/health[reset]", config.HealthCheckPort) ··· 59 60 ll.ErrorDisplay("could not connect to database", err) 60 61 } 61 62 62 - ll.Log("Connecting", "cyan", "to NATS server at [bold]%s[reset]", nats.DefaultURL) 63 - nc, err := nats.Connect(nats.DefaultURL) 63 + ll.Log("Connecting", "cyan", "to NATS server at [bold]%s[reset]", config.NatsURL) 64 + nc, err := nats.Connect(config.NatsURL) 64 65 if err != nil { 65 - ll.ErrorDisplay("could not connect to NATS at %s", err, nats.DefaultURL) 66 + ll.ErrorDisplay("could not connect to NATS at %s", err, config.NatsURL) 66 67 return 67 68 } 68 69