Skip to content

Commit

Permalink
fix(docker): export cache file
Browse files Browse the repository at this point in the history
  • Loading branch information
greenhat616 committed Sep 13, 2023
1 parent 681196c commit 0d2bfc7
Show file tree
Hide file tree
Showing 3 changed files with 2 additions and 9 deletions.
2 changes: 1 addition & 1 deletion cache/base.go
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ import (
var Collection *zcache.Cache[string, []byte]

// DataFilePath 是缓存记录文件地址
var DataFilePath = filepath.Join(util.MustGetExecDir(), "cache.data")
var DataFilePath = filepath.Join(util.MustGetExecDir(), "./data", "cache.data")

// LoadFromDisk 用于初始化缓存驱动
func LoadFromDisk() {
Expand Down
8 changes: 0 additions & 8 deletions prestart/do.go
Original file line number Diff line number Diff line change
@@ -1,21 +1,13 @@
package prestart

import (
"encoding/gob"
"github.com/hitokoto-osc/Moe/cache"
"github.com/hitokoto-osc/Moe/database"
"github.com/hitokoto-osc/Moe/task"
"github.com/hitokoto-osc/Moe/task/status"
"github.com/hitokoto-osc/Moe/task/status/types"
)

// Do is a func will be called at init, registering the drivers of program
func Do() {
// TODO: 用更好的方法修复缓存读写问题
gob.Register([]database.APIRecord{})
gob.Register(types.GeneratedData{})
gob.Register(status.TDownServerList{})

cache.LoadFromDisk()
initConfigDriver()
database.InitDB()
Expand Down
1 change: 1 addition & 0 deletions prestart/init_config_driver.go
Original file line number Diff line number Diff line change
Expand Up @@ -48,6 +48,7 @@ func initConfigDriver() {
viper.AddConfigPath(".")
viper.AddConfigPath("./conf")
viper.AddConfigPath("./config")
viper.AddConfigPath("./data") // docker purpose
viper.AddConfigPath("../conf")
viper.AddConfigPath("../config")
err := viper.ReadInConfig()
Expand Down

0 comments on commit 0d2bfc7

Please sign in to comment.