config

package
v0.0.0-...-9a2eb6e Latest Latest
Warning

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

Go to latest
Published: Nov 30, 2022 License: Apache-2.0 Imports: 9 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var DefaultConfig = Config{
	LoggingDir: "log",
	BaseDomain: "example.com",
	AutoSignUp: true,
	PassSignIn: false,
	HTTPServer: HTTPServerConfig{
		Enable: true,
		Addr:   "0.0.0.0:8080",
		TLS:    TLSConfig{Enable: false},
	},
	GateServer: []GateServerConfig{{
		Name:        "os_beta01",
		Title:       "127.0.0.1:22101",
		DispatchUrl: "http://127.0.0.1:8080/query_cur_region",
	}, {
		Name:  "os_beta02",
		Title: "127.0.0.1:22102",
		Addr:  "127.0.0.1:22102",
	}},
	GameServer: GameServerConfig{
		Enable: true,
		Addr:   "0.0.0.0:22102",
		Filter: FilterConfig{
			Enable: true,
			Rules: []string{
				"allow:*",
				"block:WindSeedClientNotify",
				"block:PlayerLuaShellNotify",
			},
		},
	},
	Database: DatabaseConfig{
		Driver: "sqlite",
		DSN:    "file:data/hk4e-emu.db?cache=shared&mode=rwc",
	},
}

Functions

This section is empty.

Types

type Config

type Config struct {
	LoggingDir string             `mapstructure:"loggingDir"`
	BaseDomain string             `mapstructure:"baseDomain"`
	AutoSignUp bool               `mapstructure:"autoSignUp"`
	PassSignIn bool               `mapstructure:"passSignIn"`
	HTTPServer HTTPServerConfig   `mapstructure:"httpServer"`
	GateServer []GateServerConfig `mapstructure:"gateServer"`
	GameServer GameServerConfig   `mapstructure:"gameServer"`
	Database   DatabaseConfig     `mapstructure:"database"`
}

func LoadConfig

func LoadConfig() (cfg Config)

func LoadConfigName

func LoadConfigName(name string) (cfg Config)

type DatabaseConfig

type DatabaseConfig struct {
	Driver string `mapstructure:"driver"`
	DSN    string `mapstructure:"dsn"`
}

type FilterConfig

type FilterConfig struct {
	Enable bool     `mapstructure:"enable"`
	Rules  []string `mapstructure:"rules"`
}

type GameServerConfig

type GameServerConfig struct {
	Enable bool         `mapstructure:"enable"`
	Addr   string       `mapstructure:"addr"`
	Filter FilterConfig `mapstructure:"filter"`
}

type GateServerConfig

type GateServerConfig struct {
	Name        string `mapstructure:"name"`
	Title       string `mapstructure:"title"`
	Addr        string `mapstructure:"addr"`
	DispatchUrl string `mapstructure:"dispatchUrl"`
}

type HTTPServerConfig

type HTTPServerConfig struct {
	Enable bool      `mapstructure:"enable"`
	Addr   string    `mapstructure:"addr"`
	TLS    TLSConfig `mapstructure:"tls"`
}

type TLSConfig

type TLSConfig struct {
	Enable   bool   `mapstructure:"enable"`
	Addr     string `mapstructure:"addr"`
	CertFile string `mapstructure:"certFile"`
	KeyFile  string `mapstructure:"keyFile"`
}

Jump to

Keyboard shortcuts

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