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: 11 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)

	Is = new(I)
)

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
	ControlHost string
}

Common Configuration parameters

type Config

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

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 I

type I struct {
	HttpClient *http.Client
}

I ...

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 Machine

type Machine struct {
	MachineId string
	Cookie    string
}

Machine

func (*Machine) Read

func (a *Machine) Read() (*Machine, error)

func (*Machine) SetCookie

func (a *Machine) SetCookie(cookie string)

func (*Machine) SetMachineId

func (a *Machine) SetMachineId(macid string)

func (*Machine) Write

func (a *Machine) Write() error

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