config

package
v0.0.3 Latest Latest
Warning

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

Go to latest
Published: Jan 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
	LogConfig  *LogConfig `json:"log"`  //log config

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

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

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 {
	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 discovery rounds
	Interval int
}

type P2PConfig

type P2PConfig struct {
	BootNodes []string `json:"BootNode"`
	Listen    string   `json:"Listen"`
}

type RPCConfig

type RPCConfig struct {
	Enable bool `json:"enable"`

	HTTPEnabled bool `json:"hTTPEnabled"`
	WSEnabled   bool `json:"wSEnabled"`
	IPCEnabled  bool `json:"iPCEnabled"`

	HTTPEndpoint string `json:"hTTPEndpoint"`
	WSEndpoint   string `json:"wSEndpoint"`
	IPCEndpoint  string `json:"iPCEndpoint"`
}

Jump to

Keyboard shortcuts

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