repo

package
v1.0.0-rc1 Latest Latest
Warning

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

Go to latest
Published: Apr 1, 2020 License: Apache-2.0 Imports: 15 Imported by: 0

Documentation

Index

Constants

View Source
const (
	// DefaultPathName is the default config dir name
	DefaultPathName = ".pier"

	// DefaultPathRoot is the path to the default config dir location.
	DefaultPathRoot = "~/" + DefaultPathName

	// EnvDir is the environment variable used to change the path root.
	EnvDir = "PIER_PATH"

	// ConfigName is config name
	ConfigName = "pier.toml"

	// config path
	ConfigPath = "../../config"

	// KeyName
	KeyName = "key.json"

	// KeyPassword
	KeyPassword = "bitxhub"
)
View Source
const (
	// Items
	LogLevel = "log.level"
)

Variables

View Source
var RootPath string

Functions

func InitConfig

func InitConfig(path string) error

InitConfig initialize configuration

func Initialize

func Initialize(repoRoot string) error

Initialize creates .pier path and necessary configuration, account file and so on.

func KeyPath

func KeyPath(repoRoot string) string

func LoadPrivateKey

func LoadPrivateKey(repoRoot string) (crypto.PrivateKey, error)

LoadPrivateKey loads private key from config path

func PathRoot

func PathRoot() (string, error)

PathRoot returns root path (default .pier)

func PathRootWithDefault

func PathRootWithDefault(path string) (string, error)

PathRootWithDefault gets current config path with default value

func PluginPath

func PluginPath() (string, error)

PluginPath returns the plugin path

func SetPath

func SetPath(root string)

SetPath sets global config path

Types

type Appchain

type Appchain struct {
	Plugin string `toml:"plugin" json:"plugin"`
	Config string `toml:"config" json:"config"`
}

Appchain are configs about appchain

type Bitxhub

type Bitxhub struct {
	Addr       string   `toml:"addr" json:"addr"`
	Validators []string `toml:"validators" json:"validators"`
}

Bitxhub are config about bitxhub

func (*Bitxhub) GetValidators

func (bxh *Bitxhub) GetValidators() []types.Address

GetValidators gets validator address of bitxhub

type Config

type Config struct {
	RepoRoot string
	Title    string   `toml:"title" json:"title"`
	Port     Port     `toml:"port" json:"port"`
	Bitxhub  Bitxhub  `toml:"bitxhub" json:"bitxhub"`
	Log      Log      `toml:"log" json:"log"`
	Appchain Appchain `toml:"appchain" json:"appchain"`
}

Config represents the necessary config data for starting pier

func DefaultConfig

func DefaultConfig() *Config

DefaultConfig returns config with default value

func UnmarshalConfig

func UnmarshalConfig(repoRoot string) (*Config, error)

UnmarshalConfig read from config files under config path

type Log

type Log struct {
	Dir          string `toml:"dir" json:"dir"`
	Filename     string `toml:"filename" json:"filename"`
	ReportCaller bool   `mapstructure:"report_caller"`
	Level        string `toml:"level" json:"level"`
}

Log are config about log

type Port

type Port struct {
	Http  int64 `toml:"http" json:"http"`
	PProf int64 `toml:"pprof" json:"pprof"`
}

Port are ports providing http and pprof service

Jump to

Keyboard shortcuts

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