config

package
v0.9.1 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Mar 17, 2024 License: GPL-3.0 Imports: 11 Imported by: 0

Documentation

Index

Constants

View Source
const (
	DefaultNodeDataDir          string = "./data"
	DefaultNodeListenPeerAddr   string = "127.0.0.1:5290"
	DefaultNodeListenClientAddr string = "127.0.0.1:5230"
	DefaultNodeMaxSnapshots     uint32 = 5
	DefaultNodeRequestsMerged   bool   = false
)
View Source
const (
	DefaultStoreBackend = string(StoreBackendNuts)

	DefaultStoreNutsNodeNum    int64  = 1
	DefaultStoreNutsSync       bool   = false
	DefaultStoreNutsStrictMode bool   = false
	DefaultStoreNutsRWMode     string = "fileio"
)
View Source
const DefaultConfigPath string = "./config.toml"

Variables

This section is empty.

Functions

func BindEnvVar

func BindEnvVar(value flag.Value, name string)

func EncodeClusterBootstraps

func EncodeClusterBootstraps(s []ClusterBootstrap) string

func EnvBoolVar

func EnvBoolVar(p *bool, name string, value bool)

func EnvInt64Var

func EnvInt64Var(p *int64, name string, value int64)

func EnvStringVar

func EnvStringVar(p *string, name string, value string)

Types

type BasicAuth

type BasicAuth map[string]string

type Cluster

type Cluster struct {
	Bootstrap []ClusterBootstrap `toml:"bootstrap"`
}

type ClusterBootstrap

type ClusterBootstrap struct {
	Name     string `toml:"name"`
	PeerAddr string `toml:"peer-addr"`
}

func DecodeClusterBootstraps

func DecodeClusterBootstraps(s string) ([]ClusterBootstrap, error)

type Config

type Config struct {
	Node      `toml:"node"`
	Store     `toml:"store"`
	Cluster   `toml:"cluster"`
	Misc      `toml:"misc"`
	BasicAuth `toml:"basic-auth"`
	// contains filtered or unexported fields
}

func New

func New(args ...string) (cfg *Config, err error)

func ReadFromArgs

func ReadFromArgs(args ...string) (*Config, error)

func ReadFromEnv

func ReadFromEnv() *Config

func ReadFromPath

func ReadFromPath(path string) (*Config, error)

func (Config) ConfigFile

func (r Config) ConfigFile() string

func (*Config) Env

func (c *Config) Env() ServerEnv

func (Config) FirstRun

func (r Config) FirstRun() bool

type EnumNutsRWMode

type EnumNutsRWMode string
const (
	NutsRWModeFileIO EnumNutsRWMode = "fileio"
	NutsRWModeMMap   EnumNutsRWMode = "mmap"
)

func (EnumNutsRWMode) Valid

func (m EnumNutsRWMode) Valid() error

type EnumStoreBackend

type EnumStoreBackend string
const (
	StoreBackendNuts EnumStoreBackend = "nuts"
)

func (EnumStoreBackend) Valid

func (b EnumStoreBackend) Valid() error

type FilePath

type FilePath string

func (FilePath) Valid

func (p FilePath) Valid() error

type Misc

type Misc struct {
	PPROF bool `toml:"pprof"`
}

type Node

type Node struct {
	ID               string  `toml:"id"`
	DataDir          string  `toml:"data-dir"`
	ListenPeerAddr   string  `toml:"listen-peer-addr"`
	ListenClientAddr string  `toml:"listen-client-addr"`
	ListenHttpAddr   string  `toml:"listen-http-addr"`
	MaxSnapshots     uint32  `toml:"max-snapshots"`
	RequestsMerged   bool    `toml:"requests-merged"`
	TLS              NodeTLS `toml:"tls"`
}

type NodeTLS

type NodeTLS struct {
	Auto     bool   `toml:"auto"`
	CertFile string `toml:"cert-file"`
	KeyFile  string `toml:"key-file"`
}

type ServerEnv

type ServerEnv interface {
	FirstRun() bool
	ConfigFile() string
}

type Store

type Store struct {
	Backend EnumStoreBackend `toml:"backend"`
	Nuts    StoreNuts        `toml:"nuts"`
}

type StoreNuts

type StoreNuts struct {
	NodeNum    int64          `toml:"node-num"`
	Sync       bool           `toml:"sync"`
	StrictMode bool           `toml:"strict-mode"`
	RWMode     EnumNutsRWMode `toml:"rw-mode"`
}

type Validator

type Validator interface {
	Valid() error
}

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL