config

package
v0.0.0-...-3576c5c Latest Latest
Warning

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

Go to latest
Published: Jan 19, 2024 License: AGPL-3.0 Imports: 4 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var DefaultConfig = &Config{
	LogLevel:           "Info",
	GameDataConfigPath: "resources",
	MysqlDsn:           "root:password@tcp(127.0.0.1:3306)/hkrpg-go?charset=utf8mb4&parseTime=True&loc=Local",
	Account: &Account{
		AutoCreate: true,
		MaxPlayer:  -1,
	},
	Http: &Http{
		Addr:        "0.0.0.0",
		Port:        8080,
		EnableHttps: true,
		CertFile:    "data/localhost.crt",
		KeyFile:     "data/localhost.key",
	},
	Dispatch: []Dispatch{
		{
			Name:        "hkrpg-go",
			Title:       "os_usa",
			Type:        "2",
			DispatchUrl: "http://127.0.0.1:8080/query_gateway",
		},
		{
			Name:        "hkrpg-official",
			Title:       "os_usa",
			Type:        "2",
			DispatchUrl: "http://127.0.0.1:8080/query_gateway_capture",
		},
	},
	Game: &Game{
		Addr: "127.0.0.1",
		Port: 22102,
	},
	GmKey: "",
	Email: &email{
		From:     "123456789@qq.com",
		Addr:     "smtp.qq.com:587",
		Host:     "smtp.qq.com",
		Identity: "123456789",
	},
}
View Source
var FileNotExist = errors.New("config file not found")

Functions

func LoadConfig

func LoadConfig() error

Types

type Account

type Account struct {
	AutoCreate bool  `json:"autoCreate"`
	MaxPlayer  int32 `json:"maxPlayer"`
}

type Config

type Config struct {
	LogLevel           string       `json:"LogLevel"`
	GameDataConfigPath string       `toml:"GameDataConfigPath"`
	MysqlDsn           string       `json:"MysqlDsn"`
	Account            *Account     `json:"Account"`
	Http               *Http        `json:"Http"`
	Dispatch           []Dispatch   `json:"Dispatch"`
	Game               *Game        `json:"Game"`
	GmKey              string       `json:"GmKey"`
	Email              *email       `json:"Email"`
	Ec2b               *random.Ec2b `json:"Ec2B"`
}
var CONF *Config = nil

func GetConfig

func GetConfig() *Config

type Dispatch

type Dispatch struct {
	Name        string `json:"name"`
	Title       string `json:"title"`
	Type        string `json:"type"`
	DispatchUrl string `json:"dispatchUrl"`
}

type Game

type Game struct {
	Addr string `json:"addr"`
	Port uint32 `json:"port"`
}

type Http

type Http struct {
	Addr        string `json:"addr"`
	Port        int64  `json:"port"`
	EnableHttps bool   `json:"enable"`
	CertFile    string `json:"certFile"`
	KeyFile     string `json:"keyFile"`
}

Jump to

Keyboard shortcuts

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