Skip to content

An open-source, privacy-first, self-hosted knowledge workspace where humans and AI agents work together 开源、隐私优先、自托管的知识工作空间,让人与智能体在此协作

:art: Improve load conf

Daniel7f575be6baed
diff --git a/kernel/model/conf.go b/kernel/model/conf.go
index 1dbdd26e48..1048630885 100644
--- a/kernel/model/conf.go
+++ b/kernel/model/conf.go
@@ -115,13 +115,14 @@ func InitConf() {
Conf = &AppConf{LogLevel: "debug", m: &sync.Mutex{}}
confPath := filepath.Join(util.ConfDir, "conf.json")
if gulu.File.IsExist(confPath) {
- data, err := os.ReadFile(confPath)
- if nil != err {
+ if data, err := os.ReadFile(confPath); nil != err {
logging.LogErrorf("load conf [%s] failed: %s", confPath, err)
- }
- err = gulu.JSON.UnmarshalJSON(data, Conf)
- if err != nil {
- logging.LogErrorf("parse conf [%s] failed: %s", confPath, err)
+ } else {
+ if err = gulu.JSON.UnmarshalJSON(data, Conf); err != nil {
+ logging.LogErrorf("parse conf [%s] failed: %s", confPath, err)
+ } else {
+ logging.LogInfof("loaded conf [%s]", confPath)
+ }
}
}