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 NoopSymmetricProvider(_ string) ([]byte, 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, storageConfig *Storage, loggingConfig *Logging) *HoardConfig
- type IPFSConfig
- type Logging
- type LoggingType
- type OpenPGPSecret
- type Provider
- type Secrets
- type SecretsManager
- type Storage
- func ConfigFromString(tomlString string) (*Storage, error)
- func DefaultCloud(cloud string) *Storage
- func DefaultFileSystemConfig() *Storage
- func DefaultIPFSConfig() *Storage
- func DefaultMemory() *Storage
- func GetDefaultStorage(c string) (*Storage, error)
- func NewCloud(encoding, cloud, bucket, prefix, region string) (*Storage, error)
- func NewFileSystemConfig(addressEncoding, rootDirectory string) *Storage
- func NewIPFSConfig(addressEncoding, host string) *Storage
- func NewMemory(addressEncoding string) *Storage
- func NewStorage(storageType StorageType, addressEncoding string) *Storage
- type StorageType
- type SymmetricProvider
- type SymmetricSecret
Constants ¶
View Source
const DefaultAddressEncodingName = stores.Base64EncodingName
View Source
const DefaultHoardConfigFileName = "hoard.conf"
View Source
const DefaultJSONConfigEnvironmentVariable = "HOARD_JSON_CONFIG"
View Source
const DefaultListenAddress = "tcp://:53431"
View Source
const STDINFileIdentifier = "-"
Variables ¶
View Source
var DefaultHoardConfig = NewHoardConfig(DefaultListenAddress, DefaultStorage, DefaultLogging)
View Source
var DefaultLogging = NewLogging(Json, structure.InfoChannel, structure.TraceChannel)
View Source
var DefaultStorage = NewMemory(DefaultAddressEncodingName)
View Source
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 NoopSymmetricProvider ¶
NoopSymmetricProvider returns an empty provider
func OutputLoggerMaker ¶
Types ¶
type FileSystemConfig ¶
type FileSystemConfig struct {
RootDirectory string
}
type HoardConfig ¶
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, 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 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 // Chunk size for data upload / download ChunkSize int // 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 DefaultCloud ¶
func DefaultFileSystemConfig ¶
func DefaultFileSystemConfig() *Storage
func DefaultIPFSConfig ¶
func DefaultIPFSConfig() *Storage
func DefaultMemory ¶
func DefaultMemory() *Storage
func GetDefaultStorage ¶
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 ¶
func NewSymmetricProvider ¶
func NewSymmetricProvider(conf *Secrets) SymmetricProvider
ProviderFromConfig creates a secret reader from a set of symmetric secrets
type SymmetricSecret ¶
Click to show internal directories.
Click to hide internal directories.