Browse Source

#2225

add config
tags/v1.22.6.2^2
chenyifan01 3 years ago
parent
commit
73baa29c90
2 changed files with 13 additions and 2 deletions
  1. +3
    -2
      modules/auth/wechat/auto_reply.go
  2. +10
    -0
      modules/setting/setting.go

+ 3
- 2
modules/auth/wechat/auto_reply.go View File

@@ -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


+ 10
- 0
modules/setting/setting.go View File

@@ -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()



Loading…
Cancel
Save