1
1
mirror of https://github.com/go-gitea/gitea synced 2024-12-25 01:54:26 +00:00
This commit is contained in:
6543 2020-01-08 17:32:25 +01:00 committed by Antoine GIRARD
parent bb4476908d
commit e39c238ef4

View File

@ -7,6 +7,7 @@ package setting
import ( import (
"fmt" "fmt"
"path" "path"
"path/filepath"
"strconv" "strconv"
"strings" "strings"
"time" "time"
@ -44,7 +45,7 @@ func GetQueueSettings(name string) QueueSettings {
q := QueueSettings{} q := QueueSettings{}
sec := Cfg.Section("queue." + name) sec := Cfg.Section("queue." + name)
// DataDir is not directly inheritable // DataDir is not directly inheritable
q.DataDir = path.Join(Queue.DataDir, name) q.DataDir = filepath.Join(Queue.DataDir, name)
// QueueName is not directly inheritable either // QueueName is not directly inheritable either
q.QueueName = name + Queue.QueueName q.QueueName = name + Queue.QueueName
for _, key := range sec.Keys() { for _, key := range sec.Keys() {
@ -55,8 +56,8 @@ func GetQueueSettings(name string) QueueSettings {
q.QueueName = key.MustString(q.QueueName) q.QueueName = key.MustString(q.QueueName)
} }
} }
if !path.IsAbs(q.DataDir) { if !filepath.IsAbs(q.DataDir) {
q.DataDir = path.Join(AppDataPath, q.DataDir) q.DataDir = filepath.Join(AppDataPath, q.DataDir)
} }
sec.Key("DATADIR").SetValue(q.DataDir) sec.Key("DATADIR").SetValue(q.DataDir)
// The rest are... // The rest are...
@ -82,8 +83,8 @@ func GetQueueSettings(name string) QueueSettings {
func NewQueueService() { func NewQueueService() {
sec := Cfg.Section("queue") sec := Cfg.Section("queue")
Queue.DataDir = sec.Key("DATADIR").MustString("queues/") Queue.DataDir = sec.Key("DATADIR").MustString("queues/")
if !path.IsAbs(Queue.DataDir) { if !filepath.IsAbs(Queue.DataDir) {
Queue.DataDir = path.Join(AppDataPath, Queue.DataDir) Queue.DataDir = filepath.Join(AppDataPath, Queue.DataDir)
} }
Queue.Length = sec.Key("LENGTH").MustInt(20) Queue.Length = sec.Key("LENGTH").MustInt(20)
Queue.BatchLength = sec.Key("BATCH_LENGTH").MustInt(20) Queue.BatchLength = sec.Key("BATCH_LENGTH").MustInt(20)