config

package
v0.6.1 Latest Latest
Warning

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

Go to latest
Published: Oct 1, 2021 License: Apache-2.0 Imports: 7 Imported by: 0

Documentation

Index

Constants

View Source
const (
	// DefaultGRPCAddress is the default address the gRPC server binds to.
	DefaultGRPCAddress = "0.0.0.0:9900"

	// DefaultJSONRPCAddress is the default address the JSON-RPC server binds to.
	DefaultJSONRPCAddress = "0.0.0.0:8545"

	// DefaultJSONRPCWsAddress is the default address the JSON-RPC WebSocket server binds to.
	DefaultJSONRPCWsAddress = "0.0.0.0:8546"

	// DefaultEVMTracer is the default vm.Tracer type
	DefaultEVMTracer = "json"

	DefaultGasCap uint64 = 25000000
)
View Source
const DefaultConfigTemplate = `` /* 1865-byte string literal not displayed */

DefaultConfigTemplate defines the configuration template for the EVM RPC configuration

Variables

This section is empty.

Functions

func AppConfig

func AppConfig(denom string) (string, interface{})

AppConfig helps to override default appConfig template and configs. return "", nil if no custom configuration is required for the application.

func GetDefaultAPINamespaces

func GetDefaultAPINamespaces() []string

GetDefaultAPINamespaces returns the default list of JSON-RPC namespaces that should be enabled

Types

type Config

type Config struct {
	config.Config

	EVM     EVMConfig     `mapstructure:"evm"`
	JSONRPC JSONRPCConfig `mapstructure:"json-rpc"`
	TLS     TLSConfig     `mapstructure:"tls"`
}

Config defines the server's top level configuration. It includes the default app config from the SDK as well as the EVM configuration to enable the JSON-RPC APIs.

func DefaultConfig

func DefaultConfig() *Config

DefaultConfig returns server's default configuration.

func GetConfig

func GetConfig(v *viper.Viper) Config

GetConfig returns a fully parsed Config object.

func ParseConfig

func ParseConfig(v *viper.Viper) (*Config, error)

ParseConfig retrieves the default environment configuration for the application.

func (Config) ValidateBasic

func (c Config) ValidateBasic() error

ValidateBasic returns an error any of the application configuration fields are invalid

type EVMConfig

type EVMConfig struct {
	// Tracer defines vm.Tracer type that the EVM will use if the node is run in
	// trace mode. Default: 'json'.
	Tracer string `mapstructure:"tracer"`
}

EVMConfig defines the application configuration values for the EVM.

func DefaultEVMConfig

func DefaultEVMConfig() *EVMConfig

DefaultEVMConfig returns the default EVM configuration

func (EVMConfig) Validate

func (c EVMConfig) Validate() error

Validate returns an error if the tracer type is invalid.

type JSONRPCConfig

type JSONRPCConfig struct {
	// Address defines the HTTP server to listen on
	Address string `mapstructure:"address"`
	// WsAddress defines the WebSocket server to listen on
	WsAddress string `mapstructure:"ws-address"`
	// API defines a list of JSON-RPC namespaces that should be enabled
	API []string `mapstructure:"api"`
	// Enable defines if the EVM RPC server should be enabled.
	Enable bool `mapstructure:"enable"`
	// GasCap is the global gas cap for eth-call variants.
	GasCap uint64 `mapstructure:"gas-cap"`
}

JSONRPCConfig defines configuration for the EVM RPC server.

func DefaultJSONRPCConfig

func DefaultJSONRPCConfig() *JSONRPCConfig

DefaultJSONRPCConfig returns an EVM config with the JSON-RPC API enabled by default

func (JSONRPCConfig) Validate

func (c JSONRPCConfig) Validate() error

Validate returns an error if the JSON-RPC configuration fields are invalid.

type TLSConfig added in v0.6.1

type TLSConfig struct {
	// CertificatePath the file path for the certificate .pem file
	CertificatePath string `mapstructure:"certificate-path"`
	// KeyPath the file path for the key .pem file
	KeyPath string `mapstructure:"key-path"`
}

TLSConfig defines the certificate and matching private key for the server.

func DefaultTLSConfig added in v0.6.1

func DefaultTLSConfig() *TLSConfig

DefaultTLSConfig returns the default TLS configuration

func (TLSConfig) Validate added in v0.6.1

func (c TLSConfig) Validate() error

Validate returns an error if the TLS certificate and key file extensions are invalid.

Jump to

Keyboard shortcuts

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