mirror of
https://github.com/zitadel/zitadel.git
synced 2025-08-11 21:37:32 +00:00
policies implemented
This commit is contained in:
20
internal/api/service/service.go
Normal file
20
internal/api/service/service.go
Normal file
@@ -0,0 +1,20 @@
|
||||
package service
|
||||
|
||||
import "context"
|
||||
|
||||
type serviceKey struct{}
|
||||
|
||||
var key *serviceKey = (*serviceKey)(nil)
|
||||
|
||||
func WithService(partent context.Context, serviceName string) context.Context {
|
||||
return context.WithValue(partent, key, serviceName)
|
||||
}
|
||||
|
||||
func FromContext(ctx context.Context) string {
|
||||
value := ctx.Value(key)
|
||||
if name, ok := value.(string); ok {
|
||||
return name
|
||||
}
|
||||
|
||||
return ""
|
||||
}
|
Reference in New Issue
Block a user