35 lines
621 B
Go
35 lines
621 B
Go
package config
|
|
|
|
import (
|
|
"log"
|
|
|
|
"github.com/BurntSushi/toml"
|
|
)
|
|
|
|
type Config struct {
|
|
Server struct {
|
|
APIURL string
|
|
POSTURL string
|
|
}
|
|
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 {
|
|
println("配置文件不正确,请修改正确的配置文件!")
|
|
log.Fatal(err)
|
|
}
|
|
// fmt.Println(config.Group)
|
|
}
|