config

package
v0.7.0 Latest Latest
Warning

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

Go to latest
Published: Oct 29, 2024 License: Apache-2.0 Imports: 16 Imported by: 4

Documentation

Index

Constants

View Source
const (
	DefaultPort         = uint(0)
	DefaultAddress      = "0.0.0.0"
	DefaultRole         = "worker"
	DefaultConcurrency  = uint(node.DefaultConcurrency)
	DefaultUseWebsocket = false
	DefaultLogLevel     = "info"
)

Default values.

View Source
const (
	DefaultDBName        = "db"
	DefaultWorkspaceName = "workspace"
)

Default names for storage directories.

View Source
const (
	EnvDelimiter = "_"
)

Variables

View Source
var DefaultConfig = Config{
	Role:        DefaultRole,
	Concurrency: DefaultConcurrency,
	Log: Log{
		Level: DefaultLogLevel,
	},
	Connectivity: Connectivity{
		Address:   DefaultAddress,
		Port:      DefaultPort,
		Websocket: DefaultUseWebsocket,
	},
}

Functions

This section is empty.

Types

type CLIFlag added in v0.6.0

type CLIFlag struct {
	Flag        string `yaml:"flag,omitempty"`
	Shorthand   string `yaml:"shorthand,omitempty"`
	Default     any    `yaml:"default,omitempty"`
	Description string `yaml:"description,omitempty"`
}

type Config

type Config struct {
	Role           string   `koanf:"role"            flag:"role,r"`
	Concurrency    uint     `koanf:"concurrency"     flag:"concurrency,c"`
	BootNodes      []string `koanf:"boot-nodes"      flag:"boot-nodes"`
	Workspace      string   `koanf:"workspace"       flag:"workspace"`       // TODO: Check - does a head node ever use a workspace?
	LoadAttributes bool     `koanf:"load-attributes" flag:"load-attributes"` // TODO: Head node probably doesn't need attributes..?
	Topics         []string `koanf:"topics"          flag:"topics"`

	DB string `koanf:"db" flag:"db"`

	Log          Log          `koanf:"log"`
	Connectivity Connectivity `koanf:"connectivity"`
	Head         Head         `koanf:"head"`
	Worker       Worker       `koanf:"worker"`
	Telemetry    Telemetry    `koanf:"telemetry"`
}

Config describes the Blockless configuration options. NOTE: DO NOT use TABS in struct tags - spaces only! NOTE: When adding CLI flags (using the `flag` struct tag) - add the description for (for the flag long version, not the shorthand) it in getFlagDescription() below.

func Load

func Load() (*Config, error)

type ConfigOption added in v0.6.0

type ConfigOption struct {
	Name     string         `yaml:"name,omitempty"`
	FullPath string         `yaml:"full_path,omitempty"`
	CLI      CLIFlag        `yaml:"cli,omitempty"`
	Env      string         `yaml:"env-var,omitempty"`
	Children []ConfigOption `yaml:"children,omitempty"`
	// contains filtered or unexported fields
}

func GetConfigDocumentation added in v0.6.0

func GetConfigDocumentation() []ConfigOption

func (ConfigOption) Info added in v0.6.0

func (c ConfigOption) Info() ConfigOptionInfo

func (ConfigOption) Type added in v0.6.0

func (c ConfigOption) Type() string

type ConfigOptionInfo added in v0.6.0

type ConfigOptionInfo struct {
	Name     string         `json:"name,omitempty"      yaml:"name,omitempty"`
	FullPath string         `json:"full_path,omitempty" yaml:"full_path,omitempty"`
	CLI      CLIFlag        `json:"cli,omitempty"       yaml:"cli,omitempty"`
	Env      string         `json:"env-var,omitempty"   yaml:"env-var,omitempty"`
	Children []ConfigOption `json:"children,omitempty"  yaml:"children,omitempty"`
	Type     string         `json:"type,omitempty"      yaml:"type,omitempty"`
}

ConfigOptionInfo describes a specific configuration option, it's location in the config file and corresponding CLI flags and environment variables. It can be used to generate documentation for the b7s node.

type Connectivity added in v0.6.0

type Connectivity struct {
	Address                 string `koanf:"address"                   flag:"address,a"`
	Port                    uint   `koanf:"port"                      flag:"port,p"`
	PrivateKey              string `koanf:"private-key"               flag:"private-key"`
	DialbackAddress         string `koanf:"dialback-address"          flag:"dialback-address"`
	DialbackPort            uint   `koanf:"dialback-port"             flag:"dialback-port"`
	Websocket               bool   `koanf:"websocket"                 flag:"websocket,w"`
	WebsocketPort           uint   `koanf:"websocket-port"            flag:"websocket-port"`
	WebsocketDialbackPort   uint   `koanf:"websocket-dialback-port"   flag:"websocket-dialback-port"`
	NoDialbackPeers         bool   `koanf:"no-dialback-peers"         flag:"no-dialback-peers"`
	MustReachBootNodes      bool   `koanf:"must-reach-boot-nodes"     flag:"must-reach-boot-nodes"`
	DisableConnectionLimits bool   `koanf:"disable-connection-limits" flag:"disable-connection-limits"`
	ConnectionCount         uint   `koanf:"connection-count"          flag:"connection-count"`
}

Connectivity describes the libp2p host that the node will use.

type GRPCTracing added in v0.7.0

type GRPCTracing struct {
	Endpoint string `koanf:"endpoint" flag:"tracing-grpc-endpoint"`
}

type HTTPTracing added in v0.7.0

type HTTPTracing struct {
	Endpoint string `koanf:"endpoint" flag:"tracing-http-endpoint"`
}
type Head struct {
	RestAPI string `koanf:"rest-api" flag:"rest-api"`
}

type Log

type Log struct {
	Level string `koanf:"level" flag:"log-level,l"`
}

Log describes the logging configuration.

type Metrics added in v0.7.0

type Metrics struct {
	Enable            bool   `koanf:"enable" flag:"enable-metrics"`
	PrometheusAddress string `koanf:"prometheus-address" flag:"prometheus-address"`
}

type Telemetry added in v0.7.0

type Telemetry struct {
	Tracing Tracing `koanf:"tracing"`
	Metrics Metrics `koanf:"metrics"`
}

type Tracing added in v0.7.0

type Tracing struct {
	Enable               bool          `koanf:"enable" flag:"enable-tracing"`
	ExporterBatchTimeout time.Duration `koanf:"exporter-batch-timeout"`
	GRPC                 GRPCTracing   `koanf:"grpc"`
	HTTP                 HTTPTracing   `koanf:"http"`
}

type Worker added in v0.6.0

type Worker struct {
	RuntimePath        string  `koanf:"runtime-path"         flag:"runtime-path"`
	RuntimeCLI         string  `koanf:"runtime-cli"          flag:"runtime-cli"`
	CPUPercentageLimit float64 `koanf:"cpu-percentage-limit" flag:"cpu-percentage-limit"`
	MemoryLimitKB      int64   `koanf:"memory-limit"         flag:"memory-limit"`
}

Jump to

Keyboard shortcuts

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