config

package
v1.0.0 Latest Latest
Warning

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

Go to latest
Published: Mar 15, 2019 License: MIT Imports: 13 Imported by: 0

Documentation

Index

Constants

View Source
const (
	QlcConfigFile = "qlc.json"
)

Variables

This section is empty.

Functions

func DefaultConfigFile

func DefaultConfigFile() string

func DefaultDataDir

func DefaultDataDir() string

DefaultDataDir is the default data directory to use for the databases and other persistence requirements.

func QlcTestDataDir

func QlcTestDataDir() string

Types

type CfgMigrate

type CfgMigrate interface {
	Migration(cfg *Config) error
	StartVersion() int
	EndVersion() int
}

type CfgMigrations

type CfgMigrations []CfgMigrate

func (CfgMigrations) Len

func (m CfgMigrations) Len() int

func (CfgMigrations) Less

func (m CfgMigrations) Less(i, j int) bool

func (CfgMigrations) Swap

func (m CfgMigrations) Swap(i, j int)

type Config

type Config struct {
	Version             int        `json:"version"`
	DataDir             string     `json:"DataDir"`
	StorageMax          string     `json:"StorageMax"`
	Mode                string     `json:"mode"` // runtime mode: Test,Normal
	AutoGenerateReceive bool       `json:"AutoGenerateReceive"`
	LogConfig           *LogConfig `json:"log"` //log config

	RPC *RPCConfig `json:"rpc"`
	P2P *P2PConfig `json:"p2p"`

	Discovery *DiscoveryConfig `json:"Discovery"`
	ID        *IdentityConfig  `json:"Identity"`

	PerformanceTest *PerformanceTestConfig
}

func DefaultConfig

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

func (*Config) DecodePrivateKey

func (cfg *Config) DecodePrivateKey() (ic.PrivKey, error)

DecodePrivateKey is a helper to decode the users PrivateKey

func (*Config) LedgerDir

func (c *Config) LedgerDir() string

func (*Config) LogDir

func (c *Config) LogDir() string

func (*Config) WalletDir

func (c *Config) WalletDir() string

type ConfigManager

type ConfigManager struct {
	// contains filtered or unexported fields
}

func NewCfgManager

func NewCfgManager(path string) *ConfigManager

func (*ConfigManager) Load

func (c *ConfigManager) Load(migrations ...CfgMigrate) (*Config, error)

Load the config file and will create default if config file no exist

type DiscoveryConfig

type DiscoveryConfig struct {
	// Time in seconds between remote discovery rounds
	DiscoveryInterval int
	//The maximum number of discovered nodes at a time
	Limit int
	MDNS  MDNS
}

type IdentityConfig

type IdentityConfig struct {
	PeerID  string
	PrivKey string `json:",omitempty"`
}

Identity tracks the configuration of the local node's identity.

type LogConfig

type LogConfig struct {
	Level            string   `json:"level"` // log level: info,warn,debug
	OutputPaths      []string `json:"outputPaths"`
	ErrorOutputPaths []string `json:"errorOutputPaths"`
	Encoding         string   `json:"encoding"`
	EncoderConfig    struct {
		MessageKey   string `json:"messageKey"`
		LevelKey     string `json:"levelKey"`
		LevelEncoder string `json:"levelEncoder"`
	} `json:"encoderConfig"`
}

type MDNS

type MDNS struct {
	Enabled bool
	// Time in seconds between local discovery rounds
	Interval int
}

type P2PConfig

type P2PConfig struct {
	BootNodes []string `json:"BootNode"`
	Listen    string   `json:"Listen"`
	//Time in seconds between sync block interval
	SyncInterval int `json:"SyncInterval"`
}

type PerformanceTestConfig added in v0.0.9

type PerformanceTestConfig struct {
	Enabled bool
}

type RPCConfig

type RPCConfig struct {
	Enable bool `json:"enable"`
	//Listen string `json:"Listen"`
	HTTPEndpoint     string   `json:"hTTPEndpoint"`
	HTTPEnabled      bool     `json:"hTTPEnabled"`
	HTTPCors         []string `json:"hTTPCors"`
	HttpVirtualHosts []string `json:"httpVirtualHosts"`

	WSEnabled   bool   `json:"wSEnabled"`
	WSEndpoint  string `json:"wSEndpoint"`
	IPCEndpoint string `json:"iPCEndpoint"`

	IPCEnabled bool `json:"iPCEnabled"`
}

Jump to

Keyboard shortcuts

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