1
0
mirror of https://github.com/v2fly/v2ray-core.git synced 2024-10-22 19:55:55 -04:00
v2fly/common/environment/envctx/env.go

16 lines
358 B
Go
Raw Normal View History

2021-09-05 10:36:57 -04:00
package envctx
import "context"
const (
2022-02-06 16:53:15 -05:00
environmentKey string = "v2.environment"
2021-09-05 10:36:57 -04:00
)
func ContextWithEnvironment(ctx context.Context, environment interface{}) context.Context {
2022-04-29 16:36:26 -04:00
return context.WithValue(ctx, environmentKey, environment) //nolint: revive
2021-09-05 10:36:57 -04:00
}
func EnvironmentFromContext(ctx context.Context) interface{} {
return ctx.Value(environmentKey)
2021-09-05 10:36:57 -04:00
}