改善配置模块代码~

This commit is contained in:
2025-05-20 09:01:07 +08:00
parent a66f1c69b1
commit 67573e6ac2
9 changed files with 61 additions and 102 deletions

View File

@@ -1,20 +1,26 @@
package config
var (
ListenPort int
DB database
Session string
Semester int
StartTime string
Week int
File string
)
type database struct {
Type string
Path string
Port int
User string
Password string
Name string
type Config struct {
App struct {
Name string `mapstructure:"Name"`
ListenPort int `mapstructure:"ListenPort"`
File string `mapstructure:"File"`
} `mapstructure:"app"`
DB struct {
Type string `mapstructure:"Tyoe"`
Path string `mapstructure:"Path"`
Port int `mapstructure:"Port"`
User string `mapstructure:"User"`
Password string `mapstructure:"Password"`
Name string `mapstructure:"Name"`
} `mapstructure:"DB"`
Business struct {
Session string `mapstructure:"Session"`
Semester int `mapstructure:"Semester"`
StartTime string `mapstructure:"StartTime"`
Week int `mapstructure:"Week"`
} `mapstructure:"business"`
}
var pathToConfigure string
var Default Config