caddy-ingess/internal/caddy/global/secrets_store.go
Marc-Antoine cce8e52ddd
feat: Add plugin system to controller (#86)
* feat: Add plugin system to controller

* add priority system and default empty tls connection policy
2022-04-15 13:53:58 +02:00

37 lines
801 B
Go

package global
import (
"github.com/caddyserver/ingress/pkg/converter"
"github.com/caddyserver/ingress/pkg/store"
)
type SecretsStorePlugin struct{}
func (p SecretsStorePlugin) IngressPlugin() converter.PluginInfo {
return converter.PluginInfo{
Name: "secrets_store",
New: func() converter.Plugin { return new(SecretsStorePlugin) },
}
}
func init() {
converter.RegisterPlugin(SecretsStorePlugin{})
}
func (p SecretsStorePlugin) GlobalHandler(config *converter.Config, store *store.Store) error {
config.Storage = converter.Storage{
System: "secret_store",
StorageValues: converter.StorageValues{
Namespace: store.CurrentPod.Namespace,
LeaseId: store.Options.LeaseId,
},
}
return nil
}
// Interface guards
var (
_ = converter.GlobalMiddleware(SecretsStorePlugin{})
)