conf

package
v1.4.2 Latest Latest
Warning

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

Go to latest
Published: May 30, 2023 License: Apache-2.0 Imports: 10 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func FillRuntimeKey

func FillRuntimeKey() error

FillRuntimeKey fills parameters of keys from runtime parameters

func FillRuntimePaths

func FillRuntimePaths() error

FillRuntimePaths fills paths from runtime parameters

func GetNodesAddr

func GetNodesAddr() []string

GetNodesAddr returns address of nodes

func LoadConfig

func LoadConfig(path string) error

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

func LoadConfigToVar

func LoadConfigToVar(path string, v *GlobalConfig) error

func SaveConfig

func SaveConfig(path string) error

SaveConfig save global parameters to configFile

Types

type BanKeyConfig

type BanKeyConfig struct {
	BadTime int // control time period in minutes
	BanTime int // ban time in minutes
	BadTx   int // maximum bad tx during badTime minutes
}

BanKeyConfig parameters

type BlockSyncMethod

type BlockSyncMethod struct {
	Method string
}

type BootstrapNodeConfig

type BootstrapNodeConfig struct {
	NodesAddr []string
}

type CentrifugoConfig

type CentrifugoConfig struct {
	Secret string
	URL    string
	Key    string
}

CentrifugoConfig connection params

type CryptoSettings

type CryptoSettings struct {
	Cryptoer string
	Hasher   string
}

type DBConfig

type DBConfig struct {
	Name            string
	Host            string
	Port            int
	User            string
	Password        string
	LockTimeout     int // lock_timeout in milliseconds
	IdleInTxTimeout int // postgres parameter idle_in_transaction_session_timeout
	MaxIdleConns    int // sets the maximum number of connections in the idle connection pool
	MaxOpenConns    int // sets the maximum number of open connections to the database
}

DBConfig database connection parameters

type DirectoryConfig

type DirectoryConfig struct {
	DataDir        string // application work dir (cwd by default)
	PidFilePath    string
	LockFilePath   string
	TempDir        string // temporary dir
	KeysDir        string // place for private keys files: NodePrivateKey, PrivateKey
	FirstBlockPath string
}

type GlobalConfig

type GlobalConfig struct {
	KeyID        int64  `toml:"-"`
	ConfigPath   string `toml:"-"`
	TestRollBack bool   `toml:"-"`
	FuncBench    bool   `toml:"-"`
	LocalConf    LocalConfig
	DirPathConf  DirectoryConfig
	BootNodes    BootstrapNodeConfig
	TLSConf      TLSConfig
	TCPServer    HostPort
	HTTP         HostPort
	JsonRPC      struct {
		Enabled   bool
		Namespace string
	}
	DB              DBConfig
	Redis           RedisConfig
	StatsD          StatsDConfig
	Centrifugo      CentrifugoConfig
	Log             LogConfig
	TokenMovement   TokenMovementConfig
	BanKey          BanKeyConfig
	CryptoSettings  CryptoSettings
	BlockSyncMethod BlockSyncMethod
}

GlobalConfig is storing all startup config as global struct

var Config GlobalConfig

Config global parameters

func GetConfigFromPath

func GetConfigFromPath(path string) (*GlobalConfig, error)

GetConfigFromPath read config from path and returns GlobalConfig struct

func (*GlobalConfig) GetPidPath

func (c *GlobalConfig) GetPidPath() string

GetPidPath returns path to pid file

func (GlobalConfig) IsCLB

func (c GlobalConfig) IsCLB() bool

IsCLB check running mode

func (GlobalConfig) IsCLBMaster

func (c GlobalConfig) IsCLBMaster() bool

IsCLBMaster check running mode

func (GlobalConfig) IsNode

func (c GlobalConfig) IsNode() bool

IsNode check running mode

func (GlobalConfig) IsSubNode

func (c GlobalConfig) IsSubNode() bool

IsSubNode check running mode

func (GlobalConfig) IsSupportingCLB

func (c GlobalConfig) IsSupportingCLB() bool

IsSupportingCLB check running mode

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 LocalConfig

type LocalConfig struct {
	RunNodeMode           string
	HTTPServerMaxBodySize int64
	NetworkID             int64
	MaxPageGenerationTime int64 // in milliseconds
}

LocalConfig TODO: uncategorized

type LogConfig

type LogConfig struct {
	LogTo     string
	LogLevel  string
	LogFormat string
	Syslog    Syslog
}

LogConfig represents parameters of log

type RedisConfig

type RedisConfig struct {
	Enable   bool
	Host     string
	Port     int
	Password string
	DbName   int
}

RedisConfig get redis information from config.yml

type RunMode

type RunMode string

func (RunMode) IsCLB

func (rm RunMode) IsCLB() bool

IsCLB returns true if mode equal clb

func (RunMode) IsCLBMaster

func (rm RunMode) IsCLBMaster() bool

IsCLBMaster returns true if mode equal clbMaster

func (RunMode) IsNode

func (rm RunMode) IsNode() bool

IsNode returns true if mode not equal to any CLB

func (RunMode) IsSubNode

func (rm RunMode) IsSubNode() bool

func (RunMode) IsSupportingCLB

func (rm RunMode) IsSupportingCLB() bool

IsSupportingCLB returns true if mode support clb

type StatsDConfig

type StatsDConfig struct {
	Host string
	Port int
	Name string
}

StatsDConfig statd connection parameters

type Syslog

type Syslog struct {
	Facility string
	Tag      string
}

Syslog represents parameters of syslog

type TLSConfig

type TLSConfig struct {
	Enabled bool   // TLS is on/off. It is required for https
	TLSCert string // TLSCert is a filepath of the fullchain of certificate.
	TLSKey  string // TLSKey is a filepath of the private key.
}

type TokenMovementConfig

type TokenMovementConfig struct {
	Host     string
	Port     int
	Username string
	Password string
	To       string
	From     string
	Subject  string
}

TokenMovementConfig smtp config for token movement

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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