add volume
This commit is contained in:
parent
70b506036a
commit
34d1243e06
3 changed files with 6 additions and 3 deletions
|
@ -16,4 +16,5 @@ FROM scratch
|
|||
COPY --from=builder /etc/ssl/certs/ca-certificates.crt /etc/ssl/certs/ca-certificates.crt
|
||||
COPY --from=builder /konfachcloud-discord-bot /konfachcloud-discord-bot
|
||||
|
||||
VOLUME /data
|
||||
ENTRYPOINT ["/konfachcloud-discord-bot"]
|
||||
|
|
|
@ -42,7 +42,7 @@ func (b *Bot) Close(ctx context.Context) error {
|
|||
)
|
||||
}
|
||||
|
||||
const stateFileName = "state.json"
|
||||
const stateFileName = "./data/state.json"
|
||||
|
||||
func (b *Bot) saveState() error {
|
||||
b.saveStateMu.Lock()
|
||||
|
@ -57,7 +57,9 @@ func (b *Bot) saveState() error {
|
|||
}
|
||||
|
||||
func Run(settings Settings) (*Bot, error) {
|
||||
state := State{}
|
||||
state := State{
|
||||
InitialScanLastID: make(map[string]string),
|
||||
}
|
||||
if _, err := os.Stat(stateFileName); err == nil {
|
||||
f, err := os.Open(stateFileName)
|
||||
if err != nil {
|
||||
|
|
|
@ -109,7 +109,7 @@ func (u extimagehashCodec) Unmarshal(data []byte, v any) error {
|
|||
}
|
||||
|
||||
func newHashDb(hashLength int) (kv.Store[attachmentKey, goimagehash.ExtImageHash], error) {
|
||||
opts := kvbadger.DefaultOptions("./db/hash")
|
||||
opts := kvbadger.DefaultOptions("./data/db/hash")
|
||||
opts.Codec = extimagehashCodec{hashLength: hashLength}
|
||||
return kvbadger.NewBagerKVBinaryKey[attachmentKey, goimagehash.ExtImageHash](opts)
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue