Documentation ¶
Index ¶
- Constants
- func ConsulQueryDefaults(ctx context.Context) *consul.QueryOptions
- type ConsulStorage
- func (ConsulStorage) CaddyModule() caddy.ModuleInfo
- func (cs *ConsulStorage) CertMagicStorage() (certmagic.Storage, error)
- func (cs *ConsulStorage) DecryptStorageData(bytes []byte) (*StorageData, error)
- func (cs ConsulStorage) Delete(ctx context.Context, key string) error
- func (cs *ConsulStorage) EncryptStorageData(data *StorageData) ([]byte, error)
- func (cs ConsulStorage) Exists(ctx context.Context, key string) bool
- func (cs *ConsulStorage) GetLock(key string) (*consul.Lock, bool)
- func (cs ConsulStorage) List(ctx context.Context, prefix string, recursive bool) ([]string, error)
- func (cs ConsulStorage) Load(ctx context.Context, key string) ([]byte, error)
- func (cs *ConsulStorage) Lock(ctx context.Context, key string) error
- func (cs *ConsulStorage) Provision(ctx caddy.Context) error
- func (cs ConsulStorage) Stat(ctx context.Context, key string) (certmagic.KeyInfo, error)
- func (cs ConsulStorage) Store(ctx context.Context, key string, value []byte) error
- func (cs *ConsulStorage) Unlock(_ context.Context, key string) error
- func (cs *ConsulStorage) UnmarshalCaddyfile(d *caddyfile.Dispenser) error
- type StorageData
Constants ¶
View Source
const ( // DefaultPrefix defines the default prefix in KV store DefaultPrefix = "caddytls" // DefaultAESKey needs to be 32 bytes long DefaultAESKey = "consultls-1234567890-caddytls-32" // DefaultValuePrefix sets a prefix to KV values to check validation DefaultValuePrefix = "caddy-storage-consul" // DefaultTimeout is the default timeout for Consul connections DefaultTimeout = 10 // EnvNameAESKey defines the env variable name to override AES key EnvNameAESKey = "CADDY_CLUSTERING_CONSUL_AESKEY" // EnvNamePrefix defines the env variable name to override KV key prefix EnvNamePrefix = "CADDY_CLUSTERING_CONSUL_PREFIX" // EnvValuePrefix defines the env variable name to override KV value prefix EnvValuePrefix = "CADDY_CLUSTERING_CONSUL_VALUEPREFIX" )
Variables ¶
This section is empty.
Functions ¶
func ConsulQueryDefaults ¶
func ConsulQueryDefaults(ctx context.Context) *consul.QueryOptions
Types ¶
type ConsulStorage ¶
type ConsulStorage struct { certmagic.Storage ConsulClient *consul.Client Address string `json:"address"` Token string `json:"token"` Timeout int `json:"timeout"` Prefix string `json:"prefix"` ValuePrefix string `json:"value_prefix"` AESKey []byte `json:"aes_key"` TlsEnabled bool `json:"tls_enabled"` TlsInsecure bool `json:"tls_insecure"` // contains filtered or unexported fields }
ConsulStorage allows to store certificates and other TLS resources in a shared cluster environment using Consul's key/value-store. It uses distributed locks to ensure consistency.
func (ConsulStorage) CaddyModule ¶
func (ConsulStorage) CaddyModule() caddy.ModuleInfo
func (*ConsulStorage) CertMagicStorage ¶
func (cs *ConsulStorage) CertMagicStorage() (certmagic.Storage, error)
func (*ConsulStorage) DecryptStorageData ¶
func (cs *ConsulStorage) DecryptStorageData(bytes []byte) (*StorageData, error)
func (ConsulStorage) Delete ¶
func (cs ConsulStorage) Delete(ctx context.Context, key string) error
Delete a key from Consul KV
func (*ConsulStorage) EncryptStorageData ¶
func (cs *ConsulStorage) EncryptStorageData(data *StorageData) ([]byte, error)
func (ConsulStorage) Exists ¶
func (cs ConsulStorage) Exists(ctx context.Context, key string) bool
Exists checks if a key exists
func (*ConsulStorage) Lock ¶
func (cs *ConsulStorage) Lock(ctx context.Context, key string) error
Lock acquires a distributed lock for the given key or blocks until it gets one
func (*ConsulStorage) Provision ¶
func (cs *ConsulStorage) Provision(ctx caddy.Context) error
Provision is called by Caddy to prepare the module
func (*ConsulStorage) Unlock ¶
func (cs *ConsulStorage) Unlock(_ context.Context, key string) error
Unlock releases a specific lock
func (*ConsulStorage) UnmarshalCaddyfile ¶
func (cs *ConsulStorage) UnmarshalCaddyfile(d *caddyfile.Dispenser) error
UnmarshalCaddyfile parses plugin settings from Caddyfile
storage consul { address "127.0.0.1:8500" token "consul-access-token" timeout 10 prefix "caddytls" value_prefix "myprefix" aes_key "consultls-1234567890-caddytls-32" tls_enabled "false" tls_insecure "true" }
type StorageData ¶
StorageData describes the data that is saved to KV
Click to show internal directories.
Click to hide internal directories.