config

package
v0.5.1-rc4 Latest Latest
Warning

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

Go to latest
Published: Mar 16, 2022 License: MIT Imports: 14 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var DefaultLogLevels = LogLevel{}.
	SetDefault("error").
	SetModule("accumulate", "info").
	String()

Functions

func MakeAbsolute added in v0.5.1

func MakeAbsolute(root, path string) string

func OffsetPort

func OffsetPort(addr string, offset int) (*url.URL, error)

func Store

func Store(config *Config) error

Types

type API

type API struct {
	TxMaxWaitTime      time.Duration `toml:"tx-max-wait-time" mapstructure:"tx-max-wait-time"`
	PrometheusServer   string        `toml:"prometheus-server" mapstructure:"prometheus-server"`
	ListenAddress      string        `toml:"listen-address" mapstructure:"listen-address"`
	DebugJSONRPC       bool          `toml:"debug-jsonrpc" mapstructure:"debug-jsonrpc"`
	EnableDebugMethods bool          `toml:"enable-debug-methods" mapstructure:"enable-debug-methods"`
}

type Accumulate

type Accumulate struct {
	SentryDSN string `toml:"sentry-dsn" mapstructure:"sentry-dsn"`

	Network Network `toml:"network" mapstructure:"network"`
	Storage Storage `toml:"storage" mapstructure:"storage"`
	API     API     `toml:"api" mapstructure:"api"`
	Website Website `toml:"website" mapstructure:"website"`
}

type Config

type Config struct {
	tm.Config
	Accumulate Accumulate
}

func Default

func Default(net NetworkType, node NodeType, netId string) *Config

func Load

func Load(dir string) (*Config, error)

type LogLevel added in v0.5.1

type LogLevel struct {
	Default string
	Modules [][2]string
}

LogLevel defines the default and per-module log level for Accumulate's logging.

func (LogLevel) Parse added in v0.5.1

func (l LogLevel) Parse(s string) LogLevel

Parse parses a string such as "error;accumulate=info" into a LogLevel.

func (LogLevel) SetDefault added in v0.5.1

func (l LogLevel) SetDefault(level string) LogLevel

SetDefault sets the default log level.

func (LogLevel) SetModule added in v0.5.1

func (l LogLevel) SetModule(module, level string) LogLevel

SetModule sets the log level for a module.

func (LogLevel) String added in v0.5.1

func (l LogLevel) String() string

String convers the log level into a string, for example "error;accumulate=debug".

type Network

type Network struct {
	Type          NetworkType `toml:"type" mapstructure:"type"`
	LocalSubnetID string      `toml:"local-subnet" mapstructure:"local-subnet"`
	LocalAddress  string      `toml:"local-address" mapstructure:"local-address"`
	Subnets       []Subnet    `toml:"subnets" mapstructure:"subnets"`
}

func (*Network) AnchorPool added in v0.5.1

func (n *Network) AnchorPool() *url.URL

AnchorPool returns the URL of the subnet's anchor pool.

func (*Network) GetBvnNames

func (n *Network) GetBvnNames() []string

func (*Network) GetSubnetByID

func (n *Network) GetSubnetByID(subnetID string) Subnet

func (*Network) Ledger added in v0.5.1

func (n *Network) Ledger() *url.URL

Ledger returns the URL of the subnet's ledger account.

func (*Network) NodeUrl

func (n *Network) NodeUrl(path ...string) *url.URL

NodeUrl returns the URL of the subnet, optionally with a path appended.

func (*Network) SyntheticLedger added in v0.5.1

func (n *Network) SyntheticLedger() *url.URL

SyntheticLedger returns the URL of the subnet's synthetic transaction ledger account.

func (*Network) ValidatorBook added in v0.5.1

func (n *Network) ValidatorBook() *url.URL

ValidatorBook returns the URL of the subnet's validator key book.

type NetworkType

type NetworkType string
const (
	BlockValidator NetworkType = "block-validator"
	Directory      NetworkType = "directory"
)

type Node

type Node struct {
	Address string
	Type    NodeType `toml:"type" mapstructure:"type"`
}

type NodeType

type NodeType string
const (
	Validator NodeType = "validator"
	Follower  NodeType = "follower"
)

type Storage added in v0.5.1

type Storage struct {
	Type StorageType  `toml:"type" mapstructure:"type"`
	Path string       `toml:"path" mapstructure:"path"`
	Etcd *etcd.Config `toml:"etcd" mapstructure:"etcd"`
}

type StorageType added in v0.5.1

type StorageType string
const (
	MemoryStorage StorageType = "memory"
	BadgerStorage StorageType = "badger"
	EtcdStorage   StorageType = "etcd"
)

type Subnet

type Subnet struct {
	ID    string      `toml:"id" mapstructure:"id"`
	Type  NetworkType `toml:"type" mapstructure:"type"`
	Nodes []Node      `toml:"nodes" mapstructure:"nodes"`
}

type Website

type Website struct {
	Enabled       bool   `toml:"website-enabled" mapstructure:"website-enabled"`
	ListenAddress string `toml:"website-listen-address" mapstructure:"website-listen-address"`
}

Jump to

Keyboard shortcuts

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