82 session file location (#91)

* change session file location

* makefile refactor

* gha refactor
This commit is contained in:
Marco
2023-09-26 10:25:14 +02:00
committed by GitHub
parent 8337aae438
commit 4710db25ee
5 changed files with 32 additions and 19 deletions

View File

@@ -6,10 +6,12 @@ import (
"fmt"
"log"
"os"
"path/filepath"
"sync"
"github.com/google/uuid"
"github.com/marcopeocchi/yt-dlp-web-ui/server/cli"
"github.com/marcopeocchi/yt-dlp-web-ui/server/config"
)
// In-Memory Thread-Safe Key-Value Storage with optional persistence
@@ -93,7 +95,12 @@ func (m *MemoryDB) All() *[]ProcessResponse {
func (m *MemoryDB) Persist() {
running := m.All()
fd, err := os.Create("session.dat")
sessionFile := filepath.Join(
config.Instance().GetConfig().SessionFilePath,
"session.dat",
)
fd, err := os.Create(sessionFile)
if err != nil {
log.Println(cli.Red, "Failed to persist session", cli.Reset)
}