INNER CODE UNIT · Go

main

docker/compose · relay/main.go:48

func main() {
	if err := run(); err != nil {
		log.Fatal(err)
	}
}

// run is separate from main so that a listen failure returns instead of
// exiting mid-setup: os.Exit from within main would skip the deferred
// stop(), which is harmless in practice (the process is dying either way)
// but flagged by the linter, so this shape avoids it for real.
func run() error {
	routes, err := parseRoutes(os.Getenv("RELAY_ROUTES"))
	if err != nil {
		return fmt.Errorf("RELAY_ROUTES: %w", err)
	}

	ctx, stop := signal.NotifyContext(context.Background(), syscall.SIGTERM, syscall.SIGINT)
	defer stop()

View source record →

📰 Research Paper
Loading…
⏳ Fetching content…