config

package
v1.4.0 Latest Latest
Warning

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

Go to latest
Published: Jul 31, 2024 License: AGPL-3.0 Imports: 3 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var DefaultConfig = &Config{
	LogLevel:           "Info",
	GameDataConfigPath: "resources",
	IsJumpMission:      false,
	AppList: map[string]AppList{
		"9001.1.1.1": {
			App: map[string]App{
				"port_player": {
					Port: "20041",
				},
			},
		},
		"9001.2.1.1": {
			App: map[string]App{
				"port_gt": {
					Port:      "20071",
					OuterAddr: "127.0.0.1",
				},
			},
		},
		"9001.3.1.1": {
			App: map[string]App{
				"port_service": {
					Port: "20081",
				},
			},
		},
		"9001.4.1.1": {
			App: map[string]App{
				"port_http": {
					Port: "8080",
				},
			},
		},
		"9001.5.1.1": {
			App: map[string]App{
				"port_service": {
					Port: "20091",
				},
			},
		},
		"9001.6.1.1": {
			App: map[string]App{
				"port_http": {
					Port: "20011",
				},
			},
		},
	},
	NetConf: map[string]string{
		"Node": "127.0.0.1:20081",
		"Game": "127.0.0.1:20081",
	},
	MysqlConf: map[string]MysqlConf{
		"account": {
			Dsn: "root:password@tcp(127.0.0.1:3306)/hkrpg-go-account?charset=utf8mb4&parseTime=True&loc=Local",
		},
		"user": {
			Dsn: "root:password@tcp(127.0.0.1:3306)/hkrpg-go-user?charset=utf8mb4&parseTime=True&loc=Local",
		},
		"player": {
			Dsn: "root:password@tcp(127.0.0.1:3306)/hkrpg-go-player?charset=utf8mb4&parseTime=True&loc=Local",
		},
		"conf": {
			Dsn: "root:password@tcp(127.0.0.1:3306)/hkrpg-go-conf?charset=utf8mb4&parseTime=True&loc=Local",
		},
	},
	RedisConf: map[string]RedisConf{
		"player_login": {
			Addr:     "127.0.0.1:6379",
			Password: "password",
			DB:       1,
		},
		"player_status": {
			Addr:     "127.0.0.1:6379",
			Password: "password",
			DB:       1,
		},
		"player_mail": {
			Addr:     "127.0.0.1:6379",
			Password: "password",
			DB:       1,
		},
		"player_chat": {
			Addr:     "127.0.0.1:6379",
			Password: "password",
			DB:       1,
		},
		"player_brief_data": {
			Addr:     "127.0.0.1:6379",
			Password: "password",
			DB:       1,
		},
	},
}
View Source
var FileNotExist = errors.New("config file not found")

Functions

func LoadConfig

func LoadConfig(confName string) error

Types

type App

type App struct {
	Port      string `json:"port"`
	InnerAddr string `json:"inner_addr"`
	OuterAddr string `json:"outer_addr"`
}

type AppList

type AppList struct {
	App map[string]App `json:"app"`
}

type Config

type Config struct {
	LogLevel           string               `json:"LogLevel"`
	GameDataConfigPath string               `json:"GameDataConfigPath"`
	IsJumpMission      bool                 `json:"IsJumpMission"`
	AppList            map[string]AppList   `json:"AppList"`
	NetConf            map[string]string    `json:"NetConf"`
	MysqlConf          map[string]MysqlConf `json:"MysqlConf"`
	RedisConf          map[string]RedisConf `json:"RedisConf"`
}
var CONF *Config = nil

func GetConfig

func GetConfig() *Config

type MysqlConf added in v1.2.1

type MysqlConf struct {
	Dsn string `json:"dsn"`
}

type NetConf

type NetConf struct {
}

type RedisConf added in v1.0.5

type RedisConf struct {
	Addr     string `json:"addr"`
	Password string `json:"password"`
	DB       int    `json:"db"`
}

Jump to

Keyboard shortcuts

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