Skip to content

Commit d4914d6

Browse files
authored
feat:明确root语义 (#740)
feat:明确root语义 (#740)
1 parent 9dc7817 commit d4914d6

File tree

2 files changed

+5
-1
lines changed

2 files changed

+5
-1
lines changed

server/config.yaml

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -72,6 +72,8 @@ local:
7272
# autocode configuration
7373
autocode:
7474
transfer-restart: true
75+
# root 自动适配项目根目录
76+
# 请不要手动配置,他会在项目加载的时候识别出根路径
7577
root: ""
7678
server: /server
7779
server-api: /api/v1/autocode

server/core/viper.go

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -56,9 +56,11 @@ func Viper(path ...string) *viper.Viper {
5656
if err := v.Unmarshal(&global.GVA_CONFIG); err != nil {
5757
fmt.Println(err)
5858
}
59+
// root 适配性
60+
// 根据root位置去找到对应迁移位置,保证root路径有效
5961
global.GVA_CONFIG.AutoCode.Root, _ = filepath.Abs("..")
6062
global.BlackCache = local_cache.NewCache(
6163
local_cache.SetDefaultExpire(time.Second * time.Duration(global.GVA_CONFIG.JWT.ExpiresTime)),
62-
)
64+
)
6365
return v
6466
}

0 commit comments

Comments
 (0)