Files
grafana/apps/provisioning/pkg/repository/context.go
Roberto Jiménez Sánchez 4eadc823a9 Provisioning: Move repository package to provisioning app (#110228)
* Move repository package to apps

* Move operators to grafana/grafana

* Go mod tidy

* Own package by git sync team for now

* Merged

* Do not use settings in local extra

* Remove dependency on webhook extra

* Hack to work around issue with secure contracts

* Sync Go modules

* Revert "Move operators to grafana/grafana"

This reverts commit 9f19b30a2e.
2025-09-02 09:45:44 +02:00

32 lines
725 B
Go

package repository
import (
"context"
"time"
)
// When writing values from history, we want the metadata to match Legacy grafana SQL
type CommitSignature struct {
// Name represents a person name. It is an arbitrary string.
Name string
// Email is an email, but it cannot be assumed to be well-formed.
Email string
// When is the timestamp of the signature.
When time.Time
}
type ctxAuthorKey struct{}
func WithAuthorSignature(ctx context.Context, sig CommitSignature) context.Context {
return context.WithValue(ctx, ctxAuthorKey{}, sig)
}
func GetAuthorSignature(ctx context.Context) *CommitSignature {
u, ok := ctx.Value(ctxAuthorKey{}).(CommitSignature)
if ok {
copy := u
return &copy
}
return nil
}