github.com/keybase/client/go@v0.0.0-20240309051027-028f7c731f8b/chat/s3/ctx.go (about) 1 package s3 2 3 import "golang.org/x/net/context" 4 5 // ctxkey is for getting values out of context.Context 6 type ctxkey int 7 8 // fakeS3Key is the context key to determine if we're using the fakeS3 server. 9 const fakeS3Key ctxkey = 0 10 11 // NewFakeS3Context returns a context with the fakeS3Key flag set. 12 func NewFakeS3Context(ctx context.Context) context.Context { 13 return context.WithValue(ctx, fakeS3Key, true) 14 } 15 16 func UsingFakeS3(ctx context.Context) bool { 17 fake, ok := ctx.Value(fakeS3Key).(bool) 18 if !ok { 19 return false 20 } 21 return fake 22 }