mirror of
https://github.com/go-gitea/gitea
synced 2024-12-21 16:07:51 +01:00
simplify names
This commit is contained in:
parent
a517cfdf7b
commit
e75fd2f783
@ -34,8 +34,8 @@ func runDump(ctx *cli.Context) {
|
||||
if ctx.IsSet("config") {
|
||||
setting.CustomConf = ctx.String("config")
|
||||
}
|
||||
setting.NewConfigContext()
|
||||
models.LoadModelsConfig()
|
||||
setting.NewContext()
|
||||
models.LoadConfigs()
|
||||
models.SetEngine()
|
||||
|
||||
log.Printf("Dumping local repositories...%s", setting.RepoRootPath)
|
||||
|
@ -37,7 +37,7 @@ var CmdServ = cli.Command{
|
||||
}
|
||||
|
||||
func setup(logPath string) {
|
||||
setting.NewConfigContext()
|
||||
setting.NewContext()
|
||||
log.NewGitLogger(filepath.Join(setting.LogRootPath, logPath))
|
||||
|
||||
if setting.DisableSSH {
|
||||
@ -45,9 +45,9 @@ func setup(logPath string) {
|
||||
os.Exit(1)
|
||||
}
|
||||
|
||||
models.LoadModelsConfig()
|
||||
models.LoadConfigs()
|
||||
|
||||
if setting.UseSQLite3 {
|
||||
if setting.UseSQLite3 || setting.UseTiDB {
|
||||
workDir, _ := setting.WorkDir()
|
||||
os.Chdir(workDir)
|
||||
}
|
||||
|
@ -115,7 +115,7 @@ PAGING_NUM = 10
|
||||
[mailer]
|
||||
ENABLED = false
|
||||
; Buffer length of channel, keep it as it is if you don't know what it is.
|
||||
SEND_BUFFER_LEN = 10
|
||||
SEND_BUFFER_LEN = 100
|
||||
; Name displayed in mail title
|
||||
SUBJECT = %(APP_NAME)s
|
||||
; Mail server
|
||||
|
@ -15,7 +15,7 @@ import (
|
||||
|
||||
var c = cron.New()
|
||||
|
||||
func NewCronContext() {
|
||||
func NewContext() {
|
||||
var (
|
||||
entry *cron.Entry
|
||||
err error
|
||||
|
@ -94,7 +94,7 @@ func init() {
|
||||
}
|
||||
}
|
||||
|
||||
func LoadModelsConfig() {
|
||||
func LoadConfigs() {
|
||||
sec := setting.Cfg.Section("database")
|
||||
DbCfg.Type = sec.Key("DB_TYPE").String()
|
||||
switch DbCfg.Type {
|
||||
|
File diff suppressed because one or more lines are too long
@ -70,8 +70,12 @@ func (m Message) Content() string {
|
||||
|
||||
var mailQueue chan *Message
|
||||
|
||||
func NewMailerContext() {
|
||||
mailQueue = make(chan *Message, setting.Cfg.Section("mailer").Key("SEND_BUFFER_LEN").MustInt(10))
|
||||
func NewContext() {
|
||||
if setting.MailService == nil {
|
||||
return
|
||||
}
|
||||
|
||||
mailQueue = make(chan *Message, setting.MailService.QueueLength)
|
||||
go processMailQueue()
|
||||
}
|
||||
|
||||
|
@ -229,9 +229,9 @@ func forcePathSeparator(path string) {
|
||||
}
|
||||
}
|
||||
|
||||
// NewConfigContext initializes configuration context.
|
||||
// NewContext initializes configuration context.
|
||||
// NOTE: do not print any log except error.
|
||||
func NewConfigContext() {
|
||||
func NewContext() {
|
||||
workDir, err := WorkDir()
|
||||
if err != nil {
|
||||
log.Fatal(4, "Fail to get work directory: %v", err)
|
||||
@ -545,6 +545,7 @@ func newSessionService() {
|
||||
|
||||
// Mailer represents mail service.
|
||||
type Mailer struct {
|
||||
QueueLength int
|
||||
Name string
|
||||
Host string
|
||||
From string
|
||||
@ -581,6 +582,7 @@ func newMailService() {
|
||||
}
|
||||
|
||||
MailService = &Mailer{
|
||||
QueueLength: sec.Key("SEND_BUFFER_LEN").MustInt(100),
|
||||
Name: sec.Key("NAME").MustString(AppName),
|
||||
Host: sec.Key("HOST").String(),
|
||||
User: sec.Key("USER").String(),
|
||||
|
@ -50,11 +50,11 @@ func NewServices() {
|
||||
|
||||
// GlobalInit is for global configuration reload-able.
|
||||
func GlobalInit() {
|
||||
setting.NewConfigContext()
|
||||
setting.NewContext()
|
||||
log.Trace("Custom path: %s", setting.CustomPath)
|
||||
log.Trace("Log path: %s", setting.LogRootPath)
|
||||
mailer.NewMailerContext()
|
||||
models.LoadModelsConfig()
|
||||
mailer.NewContext()
|
||||
models.LoadConfigs()
|
||||
NewServices()
|
||||
|
||||
if setting.InstallLock {
|
||||
@ -66,7 +66,7 @@ func GlobalInit() {
|
||||
}
|
||||
|
||||
models.HasEngine = true
|
||||
cron.NewCronContext()
|
||||
cron.NewContext()
|
||||
models.InitDeliverHooks()
|
||||
log.NewGitLogger(path.Join(setting.LogRootPath, "http.log"))
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user