From 1ace23f7dfc3bf4485142b7309c5232d7ec3702f Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E9=BB=91=E5=A4=9C=E8=B7=AF=E4=BA=BA?= Date: Thu, 24 Feb 2022 17:38:00 +0800 Subject: [PATCH] Add files via upload --- tmconfig/tmconfig.go | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/tmconfig/tmconfig.go b/tmconfig/tmconfig.go index 24e82e2..5eb45aa 100644 --- a/tmconfig/tmconfig.go +++ b/tmconfig/tmconfig.go @@ -22,6 +22,7 @@ import ( "strings" ) +// 存储全局配置信息 var G_TMCONFIG map[string]map[string]string // 内指定配置文件路径 @@ -79,12 +80,15 @@ func ParseConf() (err error) { } //默认的配置文件路径 - path := "../conf/conf.ini" + path := "conf/conf.ini" return parseFile(path) } // 获取整个section的配置 -func GetSection(section string) map[string]string { +func GetSection(section string) (map[string]string, err error) { + if len(G_TMCONFIG) == 0 { + return nil + } if cfm, ok := G_TMCONFIG[section]; ok { return cfm }