[O] Data dir prefix

This commit is contained in:
2025-10-25 21:28:06 +08:00
parent 89c529d83d
commit 05c3cb2b3c
2 changed files with 7 additions and 3 deletions
+3
View File
@@ -40,3 +40,6 @@ yarn-error.log*
**/*.log
package-lock.json
**/*.bun
/data
/*.JPG
+4 -3
View File
@@ -3,8 +3,9 @@ import ExifReader from "exifreader"
import { exists, mkdir } from "fs/promises"
// --- Configuration ---
const FOLDER_PHOTOS = "./photos"
const FILE_METADATA = "./metadata.json"
const FOLDER_BASE = "./data"
const FOLDER_PHOTOS = `${FOLDER_BASE}/photos`
const FILE_METADATA = `${FOLDER_BASE}/metadata.json`
// --- Types ---
// Interface for our metadata entries
@@ -67,7 +68,7 @@ async function getExifData(file: File): Promise<any> {
// Load secrets and ensure directories exist before starting
const INSTANT_KEY = process.env.INSTANT_KEY
if (!INSTANT_KEY) throw new Error("INSTANT_KEY is not defined")
if (!await exists(FOLDER_PHOTOS)) await mkdir(FOLDER_PHOTOS)
if (!await exists(FOLDER_PHOTOS)) await mkdir(FOLDER_PHOTOS, { recursive: true })
console.log("Server starting with valid 'secrets.json'.")