fix: refactor layout init
This commit is contained in:
@@ -8,6 +8,7 @@ import (
|
||||
"syscall"
|
||||
"time"
|
||||
|
||||
"github.com/ardeman/project-legalgo-go/config"
|
||||
"github.com/go-chi/chi/v5"
|
||||
"github.com/sirupsen/logrus"
|
||||
"golang.org/x/sync/errgroup"
|
||||
@@ -28,14 +29,14 @@ func Router(apiRouter chi.Router) {
|
||||
group, groupCtx := errgroup.WithContext(mainCtx)
|
||||
|
||||
group.Go(func() error {
|
||||
logrus.Infof("Listening to port %d", APP_PORT)
|
||||
logrus.Infof("Listening to port %d", config.APP_PORT)
|
||||
return svr.ListenAndServe()
|
||||
})
|
||||
|
||||
group.Go(func() error {
|
||||
<-groupCtx.Done()
|
||||
|
||||
ctxTimeout, cancel := context.WithTimeout(mainCtx, GRACEFULL_TIMEOUT*time.Second)
|
||||
ctxTimeout, cancel := context.WithTimeout(mainCtx, time.Duration(config.GRACEFULL_TIMEOUT)*time.Second)
|
||||
defer cancel()
|
||||
|
||||
svr.Shutdown(ctxTimeout)
|
||||
|
||||
Reference in New Issue
Block a user