func startServers()

in cmd/server.go [67:90]


func startServers(pCtx context.Context, cfg aws.Config) {
	ctx, cancel := context.WithCancel(pCtx)
	wg := sync.WaitGroup{}

	servers := createServers(cfg)

	// start servers
	for _, srv := range servers {
		wg.Add(1)
		go func(server *server.Server, childCtx context.Context) {
			defer wg.Done()
			server.ListenUntilContextCancelled(childCtx)
		}(srv, logger.ContextWithField(ctx, "bind-addr", srv.Addr()))
	}

	// Create a channel to listen for an interrupt or terminate signal from the operating system
	// syscall.SIGTERM is equivalent to kill which allows the process time to cleanup
	quit := make(chan os.Signal, 1)
	signal.Notify(quit, syscall.SIGTERM, syscall.SIGINT)

	<-quit
	cancel()
	wg.Wait()
}