config

package
v0.0.1 Latest Latest
Warning

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

Go to latest
Published: Aug 20, 2025 License: AGPL-3.0 Imports: 9 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var DefaultConfig = &Config{
	IsLite:           false,
	LogLevel:         "Info",
	Language:         "",
	ResourcesPath:    "./resources",
	DataPath:         "./data",
	GucooingApiKey:   mx.GetMxToken(0, 32),
	AutoRegistration: true,
	Tutorial:         false,
	OtherAddr: &OtherAddr{
		ServerInfoUrl:     "https://yostar-serverinfo.bluearchiveyostar.com",
		ManagementDataUrl: "https://prod-noticeindex.bluearchiveyostar.com/prod/index.json",
	},
	HttpNet: &HttpNet{
		InnerIp:   "0.0.0.0",
		InnerPort: "5000",
		OuterAddr: "http://127.0.0.1:5000",
		Tls:       false,
		CertFile:  "./config/cert.pem",
		KeyFile:   "./config/key.pem",
		Encoding:  true,
	},
	GateWay: &GateWay{
		MaxPlayerNum:       0,
		MaxCachePlayerTime: 10,
		BlackCmd:           make(map[string]bool),
		IsLogMsgPlayer:     false,
	},
	DB: &DB{
		DbType: "sqlite",
		Dsn:    "./sqlite/BaPs.db",
	},
	RankDB: &DB{
		DbType: "sqlite",
		Dsn:    "./sqlite/Rank.db",
	},
	Irc: &Irc{
		HostAddress: "127.0.0.1",
		Port:        16666,
		Password:    "mx123",
	},
	Mail: &Mail{
		Enable:   false,
		Username: "gucooing@BaPs.com",
		Password: "gucooing",
		Host:     "BaPs.com",
		Port:     587,
	},
}
View Source
var FileNotExist = errors.New("config file not found")

Functions

func GetAutoRegistration

func GetAutoRegistration() bool

func GetBlackCmd

func GetBlackCmd() map[string]bool

func GetDataPath

func GetDataPath() string

func GetGucooingApiKey

func GetGucooingApiKey() string

func GetIsLite

func GetIsLite() bool

func GetIsLogMsgPlayer

func GetIsLogMsgPlayer() bool

func GetResourcesPath

func GetResourcesPath() string

func GetTutorial

func GetTutorial() bool

func LoadConfig

func LoadConfig(filePath string) error

func SetDefaultConfig

func SetDefaultConfig()

Types

type Bot

type Bot struct {
	Addr     string `json:"Addr"`
	LoginNum int64  `json:"LoginNum"`
	CycLogin bool   `json:"CycLogin"`
}

func GetBot

func GetBot() *Bot

type Config

type Config struct {
	IsLite           bool       `json:"IsLite"`
	LogLevel         string     `json:"LogLevel"`
	Language         string     `json:"Language"`
	ResourcesPath    string     `json:"ResourcesPath"`
	DataPath         string     `json:"DataPath"`
	GucooingApiKey   string     `json:"GucooingApiKey"`
	AutoRegistration bool       `json:"AutoRegistration"`
	Tutorial         bool       `json:"Tutorial"`
	OtherAddr        *OtherAddr `json:"OtherAddr"`
	HttpNet          *HttpNet   `json:"HttpNet"`
	GateWay          *GateWay   `json:"GateWay"`
	DB               *DB        `json:"DB"`
	Irc              *Irc       `json:"Irc"`
	RankDB           *DB        `json:"RankDB"`
	Mail             *Mail      `json:"Mail"`
	Bot              *Bot       `json:"Bot"`
}
var CONF *Config = nil

func GetConfig

func GetConfig() *Config

func (*Config) String

func (c *Config) String() string

type DB

type DB struct {
	DbType string `json:"dbType"`
	Dsn    string `json:"dsn"`
}

func GetRankDB

func GetRankDB() *DB

type GateWay

type GateWay struct {
	MaxPlayerNum       int64           `json:"MaxPlayerNum"`
	MaxCachePlayerTime int             `json:"MaxCachePlayerTime"`
	BlackCmd           map[string]bool `json:"BlackCmd"`
	IsLogMsgPlayer     bool            `json:"IsLogMsgPlayer"`
}

func GetGateWay

func GetGateWay() *GateWay

type HttpNet

type HttpNet struct {
	InnerIp   string `json:"InnerIp"`
	InnerPort string `json:"InnerPort"`
	OuterAddr string `json:"OuterAddr"`
	Tls       bool   `json:"Tls"`
	CertFile  string `json:"CertFile"`
	KeyFile   string `json:"KeyFile"`
	Encoding  bool   `json:"Encoding"`
}

func GetHttpNet

func GetHttpNet() *HttpNet

func (*HttpNet) GetOuterAddr

func (x *HttpNet) GetOuterAddr() string

type Irc

type Irc struct {
	HostAddress string `json:"HostAddress"`
	Port        int32  `json:"Port"`
	Password    string `json:"Password"`
}

func GetIrc

func GetIrc() *Irc

type Mail

type Mail struct {
	Enable   bool   `json:"Enable"`
	Username string `json:"Username"`
	Password string `json:"Password"`
	Host     string `json:"Host"`
	Port     int    `json:"Port"`
}

func GetMail

func GetMail() *Mail

type OtherAddr

type OtherAddr struct {
	ServerInfoUrl     string `json:"ServerInfoUrl"`
	ManagementDataUrl string `json:"ManagementDataUrl"`
}

func GetOtherAddr

func GetOtherAddr() *OtherAddr

func (*OtherAddr) GetManagementDataUrl

func (x *OtherAddr) GetManagementDataUrl() string

func (*OtherAddr) GetServerInfoUrl

func (x *OtherAddr) GetServerInfoUrl() string

Jump to

Keyboard shortcuts

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