diff --git a/modules/auth/wechat/auto_reply.go b/modules/auth/wechat/auto_reply.go index 7d3a30d07..b1af33113 100644 --- a/modules/auth/wechat/auto_reply.go +++ b/modules/auth/wechat/auto_reply.go @@ -3,6 +3,7 @@ package wechat import ( "code.gitea.io/gitea/models" "code.gitea.io/gitea/modules/log" + "code.gitea.io/gitea/modules/setting" "encoding/json" "github.com/patrickmn/go-cache" "strings" @@ -70,12 +71,12 @@ func GetAutomaticReply(msg string) *AutomaticResponseContent { func loadAutomaticReplyFromDisk() ([]*AutomaticResponseContent, error) { log.Debug("LoadAutomaticResponseMap from disk") - repo, err := models.GetRepositoryByOwnerAndAlias("OpenIOSSG", "promote") + repo, err := models.GetRepositoryByOwnerAndAlias(setting.UserNameOfAutoReply, setting.RepoNameOfAutoReply) if err != nil { log.Error("get notice repo failed, error=%v", err) return nil, err } - repoFile, err := models.ReadLatestFileInRepo("OpenIOSSG", repo.Name, "master", "wechat/auto_reply.json") + repoFile, err := models.ReadLatestFileInRepo(setting.UserNameOfAutoReply, repo.Name, setting.RefNameOfAutoReply, setting.TreePathOfAutoReply) if err != nil { log.Error("GetNewestNotice failed, error=%v", err) return nil, err diff --git a/modules/setting/setting.go b/modules/setting/setting.go index 5c87b68c5..1750d1876 100755 --- a/modules/setting/setting.go +++ b/modules/setting/setting.go @@ -545,6 +545,12 @@ var ( WechatQRCodeExpireSeconds int WechatAuthSwitch bool + //wechat auto reply config + UserNameOfAutoReply string + RepoNameOfAutoReply string + RefNameOfAutoReply string + TreePathOfAutoReply string + //nginx proxy PROXYURL string RadarMap = struct { @@ -1372,6 +1378,10 @@ func NewContext() { WechatAppSecret = sec.Key("APP_SECRET").MustString("e48e13f315adc32749ddc7057585f198") WechatQRCodeExpireSeconds = sec.Key("QR_CODE_EXPIRE_SECONDS").MustInt(120) WechatAuthSwitch = sec.Key("AUTH_SWITCH").MustBool(true) + UserNameOfAutoReply = sec.Key("AUTO_REPLY_USER_NAME").MustString("OpenIOSSG") + RepoNameOfAutoReply = sec.Key("AUTO_REPLY_REPO_NAME").MustString("promote") + RefNameOfAutoReply = sec.Key("AUTO_REPLY_REF_NAME").MustString("master") + TreePathOfAutoReply = sec.Key("AUTO_REPLY_USER_NAME").MustString("wechat/auto_reply.json") SetRadarMapConfig()