Documentation ¶
Index ¶
- Constants
- Variables
- func Cascade(logWriter io.Writer, shortCircuit bool, sources ...Provider) *configSource
- func Default() *configSource
- func Environment(key string) *configSource
- func File(configFile string) *configSource
- func Logger(loggingConfig *Logging, writer io.Writer) (log.Logger, error)
- func NewTerminalLogger(loggingType LoggingType, writer io.Writer) (log.Logger, error)
- func OutputLoggerMaker(loggingType LoggingType) (func(writer io.Writer) log.Logger, error)
- func XDGBaseDir() *configSource
- type Cloud
- type FileSystemConfig
- type HoardConfig
- func HoardConfigFromJSONString(jsonString string) (*HoardConfig, error)
- func HoardConfigFromTOMLString(tomlString string) (*HoardConfig, error)
- func HoardConfigFromYAMLString(yamlString string) (*HoardConfig, error)
- func NewHoardConfig(listenAddress string, chunkSize int, storageConfig *Storage, ...) *HoardConfig
- type IPFSConfig
- type Logging
- type LoggingType
- type OpenPGPSecret
- type Provider
- type SecretKey
- type Secrets
- type SecretsManager
- type Storage
- func ConfigFromString(tomlString string) (*Storage, error)
- func GetDefaultStorage(storageType StorageType) (*Storage, error)
- func NewDefaultCloud(cloud StorageType) *Storage
- func NewDefaultFileSystemConfig() *Storage
- func NewDefaultIPFSConfig() *Storage
- func NewDefaultMemory() *Storage
- func NewDefaultStorage() *Storage
- func NewFileSystemConfig(addressEncoding, rootDirectory string) *Storage
- func NewIPFSConfig(addressEncoding, host string) *Storage
- func NewStorage(storageType StorageType, addressEncoding string) *Storage
- type StorageType
- type SymmetricProvider
- type SymmetricSecret
Constants ¶
const DefaultAddressEncodingName = stores.Base64EncodingName
const DefaultChunkSize = 1 << 16 // 64 Kb
const DefaultHoardConfigFileName = "hoard.conf"
const DefaultJSONConfigEnvironmentVariable = "HOARD_JSON_CONFIG"
const DefaultListenAddress = "tcp://:53431"
const STDINFileIdentifier = "-"
Variables ¶
var DefaultHoardConfig = NewHoardConfig(DefaultListenAddress, DefaultChunkSize, NewDefaultStorage(), DefaultLogging)
var DefaultLogging = NewLogging(Json, structure.InfoChannel, structure.TraceChannel)
var NoopSecretManager = SecretsManager{ Provider: NoopSymmetricProvider, OpenPGP: nil, }
NoopSecretManager is an empty secret manager
Functions ¶
func Environment ¶
func Environment(key string) *configSource
Source from a single environment variable with config embedded in JSON
func NewTerminalLogger ¶
func OutputLoggerMaker ¶
Types ¶
type FileSystemConfig ¶
type FileSystemConfig struct {
RootDirectory string
}
type HoardConfig ¶
type HoardConfig struct { ListenAddress string // Chunk size for data upload / download ChunkSize int Storage *Storage Logging *Logging Secrets *Secrets }
func HoardConfigFromJSONString ¶
func HoardConfigFromJSONString(jsonString string) (*HoardConfig, error)
func HoardConfigFromTOMLString ¶
func HoardConfigFromTOMLString(tomlString string) (*HoardConfig, error)
func HoardConfigFromYAMLString ¶
func HoardConfigFromYAMLString(yamlString string) (*HoardConfig, error)
func NewHoardConfig ¶
func NewHoardConfig(listenAddress string, chunkSize int, storageConfig *Storage, loggingConfig *Logging) *HoardConfig
func (*HoardConfig) JSONString ¶
func (hoardConfig *HoardConfig) JSONString() string
func (*HoardConfig) TOMLString ¶
func (hoardConfig *HoardConfig) TOMLString() string
func (*HoardConfig) YAMLString ¶
func (hoardConfig *HoardConfig) YAMLString() string
type IPFSConfig ¶
type IPFSConfig struct {
RemoteAPI string
}
type Logging ¶
type Logging struct { LoggingType LoggingType Channels []structure.Channel }
Logging describes the channels to listen on, messages not on these channels will be filtered and leaving empty disables logging
func NewLogging ¶
func NewLogging(loggingType LoggingType, channels ...structure.Channel) *Logging
type LoggingType ¶
type LoggingType string
const ( Logfmt LoggingType = "logfmt" Json LoggingType = "json" )
type OpenPGPSecret ¶
type OpenPGPSecret struct { // A private (though not secret) identifier that points to a PGP keyring that this instance of hoard // will use to provide PGP grants PrivateID string File string Data []byte }
func NewOpenPGPSecret ¶
func NewOpenPGPSecret(conf *Secrets) *OpenPGPSecret
OpenPGPFromConfig reads a given PGP keyring
type Provider ¶
type Provider interface { // Description of where this provider sources its config from From() string // Get the config possibly overriding values passed in from baseConfig Get(baseConfig *HoardConfig) (*HoardConfig, error) // Return a copy of the provider that does nothing if skip is true SetSkip(skip bool) Provider // Whether to skip this provider Skip() bool }
type SecretKey ¶ added in v7.2.0
type SecretKey []byte
SecretKey allows us to encode yaml and toml as base64
func (SecretKey) MarshalText ¶ added in v7.2.0
MarshalText should fulfil most serialization interfaces to ensure that the secret key in the config is always base64 encoded
type Secrets ¶
type Secrets struct { Symmetric []*SymmetricSecret OpenPGP *OpenPGPSecret }
Secrets lists the configured secrets, Symmetric secrets are those local to the running daemon and OpenPGP identifies an entity in the given keyring
type SecretsManager ¶
type SecretsManager struct { Provider SymmetricProvider OpenPGP *OpenPGPSecret }
type Storage ¶
type Storage struct { // Acts a string enum StorageType StorageType // Address encoding name AddressEncoding string // Embedding a pointer to each type of config struct allows us to access the // relevant one, while at the same time those that are left as nil will be // omitted from being serialised. *FileSystemConfig *Cloud *IPFSConfig }
Storage identifies the configured back-end
func ConfigFromString ¶
func GetDefaultStorage ¶
func GetDefaultStorage(storageType StorageType) (*Storage, error)
func NewDefaultCloud ¶
func NewDefaultCloud(cloud StorageType) *Storage
func NewDefaultFileSystemConfig ¶
func NewDefaultFileSystemConfig() *Storage
func NewDefaultIPFSConfig ¶
func NewDefaultIPFSConfig() *Storage
func NewDefaultMemory ¶
func NewDefaultMemory() *Storage
func NewDefaultStorage ¶
func NewDefaultStorage() *Storage
func NewFileSystemConfig ¶
func NewIPFSConfig ¶
func NewStorage ¶
func NewStorage(storageType StorageType, addressEncoding string) *Storage
func (*Storage) TOMLString ¶
type StorageType ¶
type StorageType string
const ( Unspecified StorageType = "" Memory StorageType = "memory" Filesystem StorageType = "filesystem" AWS StorageType = "aws" Azure StorageType = "azure" GCP StorageType = "gcp" IPFS StorageType = "ipfs" )
func GetStorageTypes ¶
func GetStorageTypes() []StorageType
type SymmetricProvider ¶
type SymmetricProvider func(secretID string) (SymmetricSecret, error)
func NewSymmetricProvider ¶
func NewSymmetricProvider(conf *Secrets, fromEnv bool) (SymmetricProvider, error)
ProviderFromConfig creates a secret reader from a set of symmetric secrets
type SymmetricSecret ¶
type SymmetricSecret struct { // An identifier for this secret that will be stored in the clear with the grant PublicID string // We expect this to be base64 encoded SecretKey SecretKey // Needed for backwards compatability Passphrase string }
func NoopSymmetricProvider ¶
func NoopSymmetricProvider(_ string) (SymmetricSecret, error)
NoopSymmetricProvider returns an empty provider
func (*SymmetricSecret) UnmarshalTOML ¶ added in v7.2.0
func (sec *SymmetricSecret) UnmarshalTOML(in interface{}) error
func (*SymmetricSecret) UnmarshalYAML ¶ added in v7.2.0
func (sec *SymmetricSecret) UnmarshalYAML(unmarshal func(interface{}) error) error