add utils

This commit is contained in:
Samuel Lorch 2021-09-08 10:59:17 +02:00
parent 219c451098
commit f952b51065
2 changed files with 53 additions and 0 deletions

13
util/context.go Normal file
View file

@ -0,0 +1,13 @@
package util
import (
"context"
"github.com/spf13/viper"
)
func GetContext() context.Context {
ctx, cancel := context.WithTimeout(context.Background(), viper.GetViper().GetDuration("timeout"))
_ = cancel
return ctx
}