mirror of
https://gitee.com/lauix/HFish
synced 2025-05-14 21:58:02 +08:00
28 lines
453 B
Go
28 lines
453 B
Go
package conf
|
|
|
|
import (
|
|
"gopkg.in/ini.v1"
|
|
"HFish/utils/log"
|
|
)
|
|
|
|
var cfg *ini.File
|
|
|
|
func init() {
|
|
c, err := ini.Load("./config.ini")
|
|
if err != nil {
|
|
log.Pr("HFish", "127.0.0.1", "打开配置文件失败", err)
|
|
}
|
|
c.BlockMode = false
|
|
cfg = c
|
|
}
|
|
|
|
func Get(node string, key string) string {
|
|
val := cfg.Section(node).Key(key).String()
|
|
return val
|
|
}
|
|
|
|
func GetInt(node string, key string) int {
|
|
val, _ := cfg.Section(node).Key(key).Int()
|
|
return val
|
|
}
|