Skip to content

Commit

Permalink
升级Twikoo版本
Browse files Browse the repository at this point in the history
  • Loading branch information
zhaoyangkun committed Nov 11, 2023
1 parent 3c2dd32 commit b2d6f26
Showing 1 changed file with 11 additions and 12 deletions.
23 changes: 11 additions & 12 deletions config/setting/setting.go
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,6 @@ import (
"log"
"os"
"path/filepath"
"strings"
"time"

"github.com/88250/lute"
Expand Down Expand Up @@ -83,19 +82,19 @@ type smtp struct {
// InitSetting 读取 yaml 配置文件
func (s *Setting) InitSetting() {
/* 开发环境 */
// 获取当前项目根目录
rootPath, _ := os.Getwd()
// 解决 GoLand 默认单元测试环境下,读取配置文件失败的问题
rootPath = strings.Replace(rootPath, "test", "", -1)
// 拼接配置文件访问路径
yamlPath := filepath.Join(rootPath, "config", "develop.yaml")
//// 获取当前项目根目录
//rootPath, _ := os.Getwd()
//// 解决 GoLand 默认单元测试环境下,读取配置文件失败的问题
//rootPath = strings.Replace(rootPath, "test", "", -1)
//// 拼接配置文件访问路径
//yamlPath := filepath.Join(rootPath, "config", "develop.yaml")

/* 生产环境 */
//homeDir, err := os.UserHomeDir()
//if err != nil {
// log.Panicln("获取用户主目录失败:", err.Error())
//}
//yamlPath := filepath.Join(homeDir, ".aries", "aries.yaml")
homeDir, err := os.UserHomeDir()
if err != nil {
log.Panicln("获取用户主目录失败:", err.Error())
}
yamlPath := filepath.Join(homeDir, ".aries", "aries.yaml")

log.Println("配置文件路径:", yamlPath)
// 读取配置文件
Expand Down

0 comments on commit b2d6f26

Please sign in to comment.