chrly/internal/di/context.go
2024-02-14 00:56:48 +01:00

22 lines
317 B
Go

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
}