Documentation
¶
Index ¶
- Constants
- func RegisterConfigs(registry *Registry, configs []Config) error
- type Config
- type Provider
- type Registry
- func (r *Registry) Aliases() []string
- func (r *Registry) HasProviders() bool
- func (r *Registry) List(ctx context.Context, alias, path string) ([]string, error)
- func (r *Registry) Register(p Provider, alias string, cacheTTL time.Duration) error
- func (r *Registry) ResetForTests()
- func (r *Registry) Resolve(ctx context.Context, alias, path, field string) (string, error)
Constants ¶
View Source
const DefaultCacheTTL = 5 * time.Minute
Variables ¶
This section is empty.
Functions ¶
func RegisterConfigs ¶
RegisterConfigs creates and registers providers from config blocks.
Types ¶
type Config ¶
type Config struct {
Provider string `toml:"provider"`
Alias string `toml:"alias"`
Address string `toml:"address"`
Token string `toml:"token"`
CacheTTL string `toml:"cache_ttl"`
DefaultField string `toml:"default_field"`
AppRoleID string `toml:"app_role_id"`
AppRoleSecret string `toml:"app_role_secret"`
Namespace string `toml:"namespace"`
KVVersion int `toml:"kv_version"`
InsecureSkipTLS bool `toml:"insecure_skip_tls"`
}
Config describes one secret provider registration.
type Provider ¶
type Provider interface {
ID() string
Resolve(ctx context.Context, path string, field string) (string, error)
List(ctx context.Context, path string) ([]string, error)
}
Provider resolves secrets from an external source.
func NewOnePasswordProvider ¶
NewOnePasswordProvider creates a 1Password Connect-backed secret provider.
func NewProvider ¶
NewProvider creates a concrete provider from config.
func NewVaultProvider ¶
NewVaultProvider creates a Vault-backed secret provider.
type Registry ¶
type Registry struct {
// contains filtered or unexported fields
}
Registry stores secret providers by alias and caches resolved values.
func NewRegistry ¶
func NewRegistry() *Registry
NewRegistry creates an empty secret provider registry.
func (*Registry) HasProviders ¶
HasProviders reports whether any aliases are registered.
func (*Registry) ResetForTests ¶
func (r *Registry) ResetForTests()
ResetForTests clears registrations and cache. Intended for tests only.
Click to show internal directories.
Click to hide internal directories.