Initial cloud-services repo - gateway service + pkg modules

This commit is contained in:
Chris Rai
2026-01-30 23:14:52 -05:00
commit fbb820d7b3
1037 changed files with 171318 additions and 0 deletions

28
pkg/utils/app/app.go Normal file
View File

@@ -0,0 +1,28 @@
package app
import (
"os"
"os/signal"
"syscall"
"fiskerinc.com/modules/logger"
)
// Setup primes application while enabling proper
// cleanup methods
func Setup(app string, cleanup func()) {
logger.Info().Msgf("initializing %s", app)
EnableGracefulShutdown(cleanup)
}
// EnableGracefulShutdown catches ctrl+c interrupt
// to allow for graceful shutdowns
func EnableGracefulShutdown(cleanup func()) {
c := make(chan os.Signal)
signal.Notify(c, os.Interrupt, syscall.SIGTERM)
go func() {
<-c
cleanup()
os.Exit(1)
}()
}