conf

package
v1.7.0 Latest Latest
Warning

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

Go to latest
Published: Mar 30, 2022 License: GPL-3.0 Imports: 8 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Config

type Config struct {
	RuntimeID     string `koanf:"runtime_id"`
	NodeAddress   string `koanf:"node_address"`
	EnablePruning bool   `koanf:"enable_pruning"`
	PruningStep   uint64 `koanf:"pruning_step"`
	// IndexingStart. Skip indexing before this block number. Use this to avoid trying to index
	// blocks that the node doesn't have data for, such as by skipping them in checkpoint sync.
	// For sensible reasons, indexing may actually start at an even later block, such as if
	// this block is already indexed or the node indicates that it doesn't have this block.
	IndexingStart uint64 `koanf:"indexing_start"`

	Log      *LogConfig      `koanf:"log"`
	Database *DatabaseConfig `koanf:"database"`
	Gateway  *GatewayConfig  `koanf:"gateway"`
}

Config contains the CLI configuration.

func InitConfig

func InitConfig(f string) (*Config, error)

InitConfig initializes configuration from file.

func (*Config) Validate

func (cfg *Config) Validate() error

Validate performs config validation.

type DatabaseConfig

type DatabaseConfig struct {
	Host         string `koanf:"host"`
	Port         int    `koanf:"port"`
	DB           string `koanf:"db"`
	User         string `koanf:"user"`
	Password     string `koanf:"password"`
	DialTimeout  int    `koanf:"dial_timeout"`
	ReadTimeout  int    `koanf:"read_timeout"`
	WriteTimeout int    `koanf:"write_timeout"`
	MaxOpenConns int    `koanf:"max_open_conns"`
}

DatabaseConfig is the postgresql database configuration.

func (*DatabaseConfig) Validate

func (cfg *DatabaseConfig) Validate() error

Validate validates the database configuration.

type GatewayConfig

type GatewayConfig struct {
	// HTTP is the gateway http endpoint config.
	HTTP *GatewayHTTPConfig `koanf:"http"`

	// WS is the gateway websocket endpoint config.
	WS *GatewayWSConfig `koanf:"ws"`

	// ChainID defines the Ethereum network chain id.
	ChainID uint32 `koanf:"chain_id"`

	// MethodLimits is the gateway method limits config.
	MethodLimits *MethodLimits `koanf:"method_limits"`
}

GatewayConfig is the gateway server configuration.

func (*GatewayConfig) Validate

func (cfg *GatewayConfig) Validate() error

Validate validates the gateway configuration.

type GatewayHTTPConfig

type GatewayHTTPConfig struct {
	// Host is the host interface on which to start the HTTP RPC server. Defaults to localhost.
	Host string `koanf:"host"`

	// Port is the port number on which to start the HTTP RPC server. Defaults to 8545.
	Port int `koanf:"port"`

	// Cors are the CORS allowed urls.
	Cors []string `koanf:"cors"`

	// VirtualHosts is the list of virtual hostnames which are allowed on incoming requests.
	VirtualHosts []string `koanf:"virtual_hosts"`

	// PathPrefix specifies a path prefix on which http-rpc is to be served. Defaults to '/'.
	PathPrefix string `koanf:"path_prefix"`

	// Timeouts allows for customization of the timeout values used by the HTTP RPC
	// interface.
	Timeouts *HTTPTimeouts `koanf:"timeouts"`
}

type GatewayWSConfig

type GatewayWSConfig struct {
	// Host is the host interface on which to start the HTTP RPC server. Defaults to localhost.
	Host string `koanf:"host"`

	// Port is the port number on which to start the HTTP RPC server. Defaults to 8545.
	Port int `koanf:"port"`

	// PathPrefix specifies a path prefix on which http-rpc is to be served. Defaults to '/'.
	PathPrefix string `koanf:"path_prefix"`

	// Origins is the list of domain to accept websocket requests from.
	Origins []string `koanf:"origins"`

	// Timeouts allows for customization of the timeout values used by the HTTP RPC
	// interface.
	Timeouts *HTTPTimeouts `koanf:"timeouts"`
}

type HTTPTimeouts

type HTTPTimeouts struct {
	Read  *time.Duration `koanf:"read"`
	Write *time.Duration `koanf:"write"`
	Idle  *time.Duration `koanf:"idle"`
}

type LogConfig

type LogConfig struct {
	Format string `koanf:"format"`
	Level  string `koanf:"level"`
	File   string `koanf:"file"`
}

LogConfig contains the logging configuration.

func (*LogConfig) Validate

func (cfg *LogConfig) Validate() error

Validate validates the logging configuration.

type MethodLimits

type MethodLimits struct {
	// GetLogsMaxRounds is the maximum number of rounds to query for in a get logs query.
	GetLogsMaxRounds uint64 `koanf:"get_logs_max_rounds"`
}

MethodLimits are the configured gateway method limits.

Jump to

Keyboard shortcuts

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