All checks were successful
Linting and tests / Linting (push) Successful in 6s
27 lines
441 B
Go
27 lines
441 B
Go
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{}{}
|
|
}()
|
|
}
|