fix: use DATABASE_FILE env var consistently and update Dockerfile

This commit is contained in:
2026-05-13 15:55:19 +02:00
parent afbfc59452
commit 239957d261
2 changed files with 3 additions and 6 deletions

View File

@@ -42,8 +42,8 @@ RUN apt-get update && apt-get install -y ca-certificates sqlite3 && rm -rf /var/
# Create data directory for sqlite
RUN mkdir -p /app/data
# Set DB_PATH to use the persistent volume
ENV DB_PATH=/app/data/mal.db
# Set DATABASE_FILE to use the persistent volume
ENV DATABASE_FILE=/app/data/mal.db
COPY --from=builder /app/main_server .
COPY --from=builder /app/templates ./templates

View File

@@ -24,10 +24,7 @@ var Module = fx.Options(
)
func ProvideSQLDB() (*sql.DB, error) {
dbPath := os.Getenv("DB_PATH")
if dbPath == "" {
dbPath = "mal.db"
}
dbPath := db.GetDBFile()
dbConn, err := db.Open(dbPath)
if err != nil {
return nil, fmt.Errorf("failed to open database: %w", err)