34 lines
663 B
Go
34 lines
663 B
Go
package secrets
|
|
|
|
import (
|
|
"context"
|
|
"time"
|
|
|
|
"github.com/tech/sendico/pkg/mlogger"
|
|
"github.com/tech/sendico/pkg/vault/kv"
|
|
)
|
|
|
|
// Provider resolves secrets by reference.
|
|
type Provider interface {
|
|
GetSecret(ctx context.Context, ref string) (string, error)
|
|
}
|
|
|
|
// VaultOptions configure Vault KV secret resolution.
|
|
type VaultOptions struct {
|
|
Config kv.Config
|
|
DefaultField string
|
|
}
|
|
|
|
// Options configure secret lookup behavior.
|
|
type Options struct {
|
|
Logger mlogger.Logger
|
|
Static map[string]string
|
|
CacheTTL time.Duration
|
|
Vault VaultOptions
|
|
}
|
|
|
|
// New creates secrets provider.
|
|
func New(opts Options) (Provider, error) {
|
|
return newProvider(opts)
|
|
}
|