params

package
v0.0.0-...-590ca12 Latest Latest
Warning

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

Go to latest
Published: Jun 30, 2020 License: GPL-3.0 Imports: 11 Imported by: 0

Documentation

Index

Constants

View Source
const (
	VersionMajor = 0       // Major version component of the current release
	VersionMinor = 2       // Minor version component of the current release
	VersionPatch = 11      // Patch version component of the current release
	VersionMeta  = "alpha" // Version metadata to append to the version string
)

version parts

Variables

View Source
var (

	// ServerAPIAddress server api address
	ServerAPIAddress string

	// DataDir datadir
	DataDir = "datadir"
)
View Source
var Version = func() string {
	return fmt.Sprintf("%d.%d.%d", VersionMajor, VersionMinor, VersionPatch)
}()

Version holds the textual version string.

View Source
var VersionWithMeta = func() string {
	v := Version
	if VersionMeta != "" {
		v += "-" + VersionMeta
	}
	return v
}()

VersionWithMeta holds the textual version string including the metadata.

Functions

func ArchiveVersion

func ArchiveVersion(gitCommit string) string

ArchiveVersion holds the textual version string used for Geth archives. e.g. "1.8.11-dea1ce05" for stable releases, or

"1.8.13-unstable-21c059b6" for unstable releases

func CheckConfig

func CheckConfig(isServer bool) (err error)

CheckConfig check config

func GetAPIPort

func GetAPIPort() int

GetAPIPort get api service port

func GetIdentifier

func GetIdentifier() string

GetIdentifier get identifier (to distiguish in dcrm accept)

func GetServerDcrmUser

func GetServerDcrmUser() string

GetServerDcrmUser get server dcrm user (initiator of dcrm sign)

func SetConfig

func SetConfig(config *ServerConfig)

SetConfig set config items

func SetDataDir

func SetDataDir(datadir string)

SetDataDir set data dir

func VersionWithCommit

func VersionWithCommit(gitCommit, gitDate string) string

VersionWithCommit add git commit and data to version.

Types

type APIServerConfig

type APIServerConfig struct {
	Port           int
	AllowedOrigins []string
}

APIServerConfig api service config

type DcrmConfig

type DcrmConfig struct {
	ServerAccount string
	RPCAddress    *string
	GroupID       *string
	SignGroups    []string
	NeededOracles *uint32
	TotalOracles  *uint32
	Mode          uint32  // 0:managed 1:private (default 0)
	Pubkey        *string `toml:",omitempty"`
	KeystoreFile  *string `toml:",omitempty"`
	PasswordFile  *string `toml:",omitempty"`
}

DcrmConfig dcrm related config

func (*DcrmConfig) CheckConfig

func (c *DcrmConfig) CheckConfig(isServer bool) (err error)

CheckConfig check dcrm config

type MongoDBConfig

type MongoDBConfig struct {
	DBURL    string
	DBName   string
	UserName string `json:"-"`
	Password string `json:"-"`
}

MongoDBConfig mongodb config

func (*MongoDBConfig) GetURL

func (cfg *MongoDBConfig) GetURL() string

GetURL get mongodb url consider user name and password

type OracleConfig

type OracleConfig struct {
	ServerAPIAddress string
}

OracleConfig oracle config

func (*OracleConfig) CheckConfig

func (c *OracleConfig) CheckConfig() (err error)

CheckConfig check oracle config

type ServerConfig

type ServerConfig struct {
	Identifier  string
	MongoDB     *MongoDBConfig   `toml:",omitempty"`
	APIServer   *APIServerConfig `toml:",omitempty"`
	SrcToken    *tokens.TokenConfig
	SrcGateway  *tokens.GatewayConfig
	DestToken   *tokens.TokenConfig
	DestGateway *tokens.GatewayConfig
	Dcrm        *DcrmConfig
	Oracle      *OracleConfig          `toml:",omitempty"`
	BtcExtra    *tokens.BtcExtraConfig `toml:",omitempty"`
}

ServerConfig config items (decode from toml file)

func GetConfig

func GetConfig() *ServerConfig

GetConfig get config items structure

func LoadConfig

func LoadConfig(configFile string, isServer bool) *ServerConfig

LoadConfig load config

Jump to

Keyboard shortcuts

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