Files
hatchet/pkg/client/context.go
abelanger5 78685d0098 feat(security): multiple encryption options, API tokens, easier setup (#125)
* (wip) encryption

* feat: api tokens

* chore: add api token generation command

* fix: e2e tests

* chore: set timeout for e2e job

* fix: e2e tests, remove client-side certs

* chore: address PR review comments

* fix: token tests

* chore: address review comments and fix tests
2024-01-26 15:38:36 -05:00

27 lines
459 B
Go

package client
import (
grpcMetadata "google.golang.org/grpc/metadata"
"context"
)
type contextLoader struct {
// The token
Token string
}
func newContextLoader(token string) *contextLoader {
return &contextLoader{
Token: token,
}
}
func (c *contextLoader) newContext(ctx context.Context) context.Context {
md := grpcMetadata.New(map[string]string{
"authorization": "Bearer " + c.Token,
})
return grpcMetadata.NewOutgoingContext(ctx, md)
}