configs

package
v0.0.0-...-c95b1fc Latest Latest
Warning

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

Go to latest
Published: May 22, 2025 License: MIT Imports: 9 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func GetConfigValue

func GetConfigValue(cfg interface{}, key string) (*reflect.Value, error)

GetConfigValue 获取配置值

func GetDefaultServerConfigPath

func GetDefaultServerConfigPath() string

func SetConfigValue

func SetConfigValue(cfg interface{}, key, value string) error

SetConfigValue 设置配置值

func WriteServerConfig

func WriteServerConfig(path string, config *ServerConfigStruct) error

WriteServerConfig 写入配置

Types

type ServerConfigStruct

type ServerConfigStruct struct {
	Listen    string               `yaml:"listen" json:"listen"`
	PublicUrl string               `yaml:"public_url" json:"public_url"`
	Security  ServerSecurityConfig `yaml:"security" json:"security"`
	Debug     bool                 `yaml:"debug" json:"debug"`
	Log       ServerLogConfig      `yaml:"log" json:"log"`
	MongoDB   ServerMongoDBConfig  `yaml:"mongodb" json:"mongodb"`
}

func GetDefaultServerConfig

func GetDefaultServerConfig() ServerConfigStruct

func ReadServerConfig

func ReadServerConfig(path string) (*ServerConfigStruct, error)

ReadServerConfig 读取配置

type ServerLogConfig

type ServerLogConfig struct {
	AccessFile string `yaml:"access_file" json:"access_file"`
	DebugFile  string `yaml:"debug_file" json:"debug_file"`
}

type ServerMongoDBConfig

type ServerMongoDBConfig struct {
	Host     string `yaml:"host" json:"host"`
	Port     int    `yaml:"port" json:"port"`
	DBName   string `yaml:"db_name" json:"db_name"`
	User     string `yaml:"user" json:"user"`
	Password string `yaml:"password" json:"password"`
}

type ServerSecurityConfig

type ServerSecurityConfig struct {
	JWTSecret string `yaml:"jwt_secret" json:"jwt_secret"`
	JWTExpire int64  `yaml:"jwt_expire" json:"jwt_expire"`
}

Jump to

Keyboard shortcuts

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