conf

package
v0.0.0-...-14a8109 Latest Latest
Warning

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

Go to latest
Published: Mar 19, 2018 License: MIT Imports: 9 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	// ConfigPath path to config file
	ConfigPath = flag.String("configPath", "", "full path to config file (toml format)")
	NoStart    = flag.Bool("noStart", false, "do not start daemon, just do all necessary job")

	// WorkDirectory application working directory
	WorkDirectory = flag.String("workDir", "", "work directory")

	// FirstBlockPath is a file (1block) where first block file will be stored
	FirstBlockPath = flag.String("firstBlockPath", "", "pathname of '1block' file")

	// InitConfig initialize config
	InitConfig = flag.Bool("initConfig", false, "write config parameters to file")

	// InitDatabase initialize database
	InitDatabase = flag.Bool("initDatabase", false, "initialize database")

	// GenerateFirstBlock force regeneration of first block
	GenerateFirstBlock = flag.Bool("generateFirstBlock", false, "generate firstblock and keys")

	// FirstBlockPublicKey is the private key
	FirstBlockPublicKey = flag.String("firstBlockPublicKey", "", "FirstBlockPublicKey")

	// FirstBlockNodePublicKey is the node private key
	FirstBlockNodePublicKey = flag.String("firstBlockNodePublicKey", "", "FirstBlockNodePublicKey")

	// FirstBlockHost is the host of the first block
	FirstBlockHost = flag.String("firstBlockHost", defaultFirstBlockHost, "FirstBlockHost")

	// WalletAddress is a wallet address for forging
	WalletAddress = flag.String("walletAddress", "", "walletAddress for forging ")

	// LogSQL show if we should display sql queries in logs
	LogSQL = flag.Bool("logSQL", false, "set DBConn.LogMode")

	// LogStackTrace show if we should display stack trace in logs
	LogStackTrace = flag.Bool("logStackTrace", false, "log stack trace")

	// TestRollBack starts special set of daemons
	TestRollBack = flag.Bool("testRollBack", false, "starts special set of daemons")

	// StartBlockID is the start block
	StartBlockID = flag.Int64("startBlockId", 0, "Start block for blockCollection daemon")

	// EndBlockID is the end block
	EndBlockID = flag.Int64("endBlockId", 0, "End block for blockCollection daemon")

	// RollbackToBlockID is the target block for rollback
	RollbackToBlockID = flag.Int64("rollbackToBlockId", 0, "Rollback to block_id")

	// TLS is a directory for .well-known and keys. It is required for https
	TLS = flag.String("tls", "", "Enable https. Ddirectory for .well-known and keys")

	// UpdateInterval is interval in seconds for checking updates
	UpdateInterval = flag.Int64("updateInterval", defaultUpdateInterval, "Interval in seconds for checking updates, default 3600 seconds (1 hour)")

	// CheckReadAccess access check for reading, is used only for VDE
	CheckReadAccess = flag.Bool("checkReadAccess", true, "Check access for reading, only used for VDE")
)
View Source
var Config = SavedConfig{
	InstallType:  "PRIVATE_NET",
	NodeStateID:  "*",
	StartDaemons: "",
	StatsD:       StatsDConfig{Name: "apla", HostPort: HostPort{Host: "127.0.0.1", Port: 8125}},
}

Config global parameters

View Source
var Installed bool

Installed web UI installation mode

Functions

func GetConfigPath

func GetConfigPath() string

GetConfigPath returns path from command line arg or default

func GetPidFile

func GetPidFile() string

GetPidFile returns path to pid file

func InitConfigFlags

func InitConfigFlags()

InitConfigFlags initialize config flags

func LoadConfig

func LoadConfig() error

LoadConfig from configFile the function has side effect updating global var Config

func NoConfig

func NoConfig() bool

NoConfig config file does not exist

func SaveConfig

func SaveConfig() error

SaveConfig save global parameters to configFile

func SetConfigParams

func SetConfigParams()

SetConfigParams set config parameters from command line

Types

type AutoupdateConfig

type AutoupdateConfig struct {
	ServerAddress string
	PublicKeyPath string
}

AutoupdateConfig is autoupdate params

type CentrifugoConfig

type CentrifugoConfig struct {
	Secret string
	URL    string
}

CentrifugoConfig connection params

type DBConfig

type DBConfig struct {
	Name string
	HostPort
	User     string
	Password string
}

DBConfig database connection parameters

type HostPort

type HostPort struct {
	Host string // ipaddr, hostname, or "0.0.0.0"
	Port int    // must be in range 1..65535
}

HostPort endpoint in form "str:int"

func (HostPort) Str

func (h HostPort) Str() string

Str converts HostPort pair to string format

type SavedConfig

type SavedConfig struct {
	LogLevel    string
	LogFileName string
	InstallType string
	NodeStateID string
	TestMode    bool

	StartDaemons string // comma separated list of daemons to start or empty for all or 'null'

	KeyID       int64
	EcosystemID int64

	BadBlocks              string
	FirstLoadBlockchainURL string
	FirstLoadBlockchain    string

	MaxPageGenerationTime int64 // in milliseconds

	TCPServer HostPort
	HTTP      HostPort
	DB        DBConfig
	StatsD    StatsDConfig

	WorkDir    string // application work dir (cwd by default)
	PrivateDir string // place for private keys files: NodePrivateKey, PrivateKey

	Centrifugo CentrifugoConfig

	Autoupdate AutoupdateConfig
}

SavedConfig parameters saved in "config.toml"

type StatsDConfig

type StatsDConfig struct {
	Name string
	HostPort
}

StatsDConfig statd connection parameters

Jump to

Keyboard shortcuts

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