27 lines
441 B
Go
Raw Normal View History

package application
import (
"os"
"os/signal"
"syscall"
)
// ShutdownChan returns shutdown channel for main function.
func (a *Application) ShutdownChan() chan struct{} {
return a.shutdownChan
}
func (a *Application) startServer() {
a.shutdownChan = make(chan struct{})
go func() {
listener := make(chan os.Signal, 1)
signal.Notify(listener, syscall.SIGTERM, os.Interrupt)
<-listener
a.shutdownChan <- struct{}{}
}()
}