Fix: relative path for SQLite file

This commit is contained in:
HFO4 2020-03-11 15:46:24 +08:00
parent 45b54b3455
commit 8ad7702736
3 changed files with 2 additions and 4 deletions

View file

@ -30,7 +30,7 @@ func Init() {
} else { } else {
if conf.DatabaseConfig.Type == "UNSET" { if conf.DatabaseConfig.Type == "UNSET" {
// 未指定数据库时使用SQLite // 未指定数据库时使用SQLite
db, err = gorm.Open("sqlite3", "cloudreve.db") db, err = gorm.Open("sqlite3", util.RelativePath("cloudreve.db"))
} else { } else {
db, err = gorm.Open(conf.DatabaseConfig.Type, fmt.Sprintf("%s:%s@(%s)/%s?charset=utf8&parseTime=True&loc=Local", db, err = gorm.Open(conf.DatabaseConfig.Type, fmt.Sprintf("%s:%s@(%s)/%s?charset=utf8&parseTime=True&loc=Local",
conf.DatabaseConfig.User, conf.DatabaseConfig.User,

View file

@ -144,8 +144,6 @@ Neue',Helvetica,Arial,sans-serif; box-sizing: border-box; font-size: 14px; verti
{Name: "home_view_method", Value: "icon", Type: "view"}, {Name: "home_view_method", Value: "icon", Type: "view"},
{Name: "share_view_method", Value: "list", Type: "view"}, {Name: "share_view_method", Value: "list", Type: "view"},
{Name: "cron_garbage_collect", Value: "@hourly", Type: "cron"}, {Name: "cron_garbage_collect", Value: "@hourly", Type: "cron"},
{Name: "cron_notify_user", Value: "@hourly", Type: "cron"},
{Name: "cron_ban_user", Value: "@hourly", Type: "cron"},
{Name: "authn_enabled", Value: "0", Type: "authn"}, {Name: "authn_enabled", Value: "0", Type: "authn"},
{Name: "captcha_height", Value: "60", Type: "captcha"}, {Name: "captcha_height", Value: "60", Type: "captcha"},
{Name: "captcha_width", Value: "240", Type: "captcha"}, {Name: "captcha_width", Value: "240", Type: "captcha"},

View file

@ -21,7 +21,7 @@ func Reload() {
func Init() { func Init() {
util.Log().Info("初始化定时任务...") util.Log().Info("初始化定时任务...")
// 读取cron日程设置 // 读取cron日程设置
options := model.GetSettingByNames("cron_garbage_collect", "cron_notify_user", "cron_ban_user") options := model.GetSettingByNames("cron_garbage_collect")
Cron := cron.New() Cron := cron.New()
for k, v := range options { for k, v := range options {
var handler func() var handler func()