chrly/internal/di/context.go

22 lines
317 B
Go
Raw Normal View History

2024-02-14 05:26:48 +05:30
package di
import (
"context"
"os"
"os/signal"
"syscall"
"github.com/defval/di"
)
var contextDiOptions = di.Options(
di.Provide(newBaseContext),
)
func newBaseContext() context.Context {
ctx := context.Background()
ctx, _ = signal.NotifyContext(ctx, os.Interrupt, syscall.SIGTERM, os.Kill)
return ctx
}