2024-04-01 09:42:29 +08:00
|
|
|
package config
|
|
|
|
|
2024-04-03 21:53:57 +08:00
|
|
|
import (
|
|
|
|
"log"
|
2024-04-01 09:42:29 +08:00
|
|
|
|
2024-04-03 21:53:57 +08:00
|
|
|
"github.com/BurntSushi/toml"
|
|
|
|
)
|
2024-04-01 09:42:29 +08:00
|
|
|
|
2024-04-03 21:53:57 +08:00
|
|
|
type Config struct {
|
|
|
|
Server struct {
|
2024-04-03 22:07:38 +08:00
|
|
|
APIURL string
|
|
|
|
POSTURL string
|
2024-04-03 21:53:57 +08:00
|
|
|
}
|
|
|
|
Group struct {
|
|
|
|
AllowGroup []string
|
|
|
|
AllowUser []string
|
|
|
|
AllowRole []string
|
|
|
|
BlockGroup []string
|
|
|
|
BlockUser []string
|
|
|
|
GroupNotAllow []string
|
|
|
|
UserNotAllow []string
|
|
|
|
RoleNotAllow []string
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
var GlobalConfig Config
|
|
|
|
|
|
|
|
func init() {
|
|
|
|
// var config Config
|
|
|
|
if _, err := toml.DecodeFile("config.toml", &GlobalConfig); err != nil {
|
2024-04-03 22:07:38 +08:00
|
|
|
println("配置文件不正确,请修改正确的配置文件!")
|
2024-04-03 21:53:57 +08:00
|
|
|
log.Fatal(err)
|
|
|
|
}
|
|
|
|
// fmt.Println(config.Group)
|
2024-04-01 09:42:29 +08:00
|
|
|
}
|