config

package
v0.0.0-...-6b52b4a Latest Latest
Warning

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

Go to latest
Published: Apr 9, 2024 License: Apache-2.0 Imports: 8 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	// C Global configuration (Must Load first, otherwise the configuration will not be available)
	C = new(Config)
)

Functions

func MustLoad

func MustLoad(fpaths ...string) error

MustLoad load config

func ParseConfigByEnv

func ParseConfigByEnv() error

func PrintWithJSON

func PrintWithJSON()

Types

type App

type App struct {
	LocalAddr      string
	LocalPort      int
	CertFile       string
	KeyFile        string
	HttpListenAddr string
}

App Configuration parameters

type Config

type Config struct {
	RunMode      string
	PrintConfig  bool
	App          App
	P2p          P2p
	Web3         Web3
	Log          Log
	LogRedisHook LogRedisHook
	Mysql        Mysql
}

func (*Config) IsDebugMode

func (c *Config) IsDebugMode() bool

func (*Config) IsReleaseMode

func (c *Config) IsReleaseMode() bool

type Contract

type Contract struct {
	Token string
}

type ETH

type ETH struct {
	URL       string
	ProjectID string
}

type Log

type Log struct {
	Level         int
	Format        string
	Output        string
	OutputFile    string
	EnableHook    bool
	HookLevels    []string
	Hook          LogHook
	HookMaxThread int
	HookMaxBuffer int
}

type LogGormHook

type LogGormHook struct {
	DBType       string
	MaxLifetime  int
	MaxOpenConns int
	MaxIdleConns int
	Table        string
}

type LogHook

type LogHook string

func (LogHook) IsRedis

func (h LogHook) IsRedis() bool

type LogRedisHook

type LogRedisHook struct {
	Addr string
	Key  string
}

type Mysql

type Mysql struct {
	Host            string
	Port            int
	User            string
	Password        string
	DBName          string
	Prefix          string
	Parameters      string
	PoolMinCap      int
	PoolExCap       int
	PoolMaxCap      int
	PoolIdleTimeout int
	PoolWaitCount   int
	PoolWaiTimeout  int
}

type P2p

type P2p struct {
	Enable               bool
	ServiceDiscoveryID   string
	ServiceDiscoveryMode string
	ServiceMetadataTopic string
}

P2p Configuration parameters

type W3S

type W3S struct {
	Token      string
	Timeout    int
	RetryCount int
}

type Web3

type Web3 struct {
	Account    string
	Price      int
	PrivateKey string
	Contract   Contract
	W3S        W3S
	ETH        ETH
}

func (*Web3) EthAddress

func (w *Web3) EthAddress() string

Jump to

Keyboard shortcuts

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