try fix .env with NUXT_ prefix
All checks were successful
Deploy App / build (push) Successful in 49s
Deploy App / deploy (push) Successful in 22s

This commit is contained in:
valere
2026-02-10 18:44:00 +01:00
parent 08db4d7388
commit ffd5c5d7eb
10 changed files with 15 additions and 24 deletions

View File

@@ -2,12 +2,12 @@ import { syncCardsWithDatabase } from '../services/cardSync.service'
export default defineEventHandler(async (event) => {
const config = useRuntimeConfig()
const folderPath = config.PATH_FILES
const folderPath = process.env.NUXT_PATH_FILES
if (!folderPath) {
throw createError({
statusCode: 500,
message: 'PATH_FILES not configured'
message: 'NUXT_PATH_FILES not configured'
})
}

View File

@@ -1,8 +1,7 @@
import { syncCardsWithDatabase } from '../../services/cardSync.service'
export default defineEventHandler(async (event) => {
const config = useRuntimeConfig()
const folderPath = config.PATH_FILES
const folderPath = process.env.NUXT_PATH_FILES
try {
const result = await syncCardsWithDatabase(folderPath)

View File

@@ -1,8 +1,7 @@
import { scanMusicFolder } from '../../utils/fileScanner'
export default defineEventHandler(async (event) => {
const config = useRuntimeConfig()
const folderPath = config.PATH_FILES
const folderPath = process.env.NUXT_PATH_FILES
try {
// Test 1: Vérifier que le dossier existe

View File

@@ -6,11 +6,10 @@ let _db: ReturnType<typeof drizzle> | null = null
export function useDB() {
if (_db) return _db
const config = useRuntimeConfig()
let dbPath = config.PATH_DB
let dbPath = process.env.NUXT_PATH_DB
if (!dbPath) {
throw new Error('PATH_DB is not configured')
throw new Error('NUXT_PATH_DB is not configured')
}
// Convertir le chemin en URL file:// si ce n'est pas déjà une URL

View File

@@ -1,11 +1,10 @@
import { syncCardsWithDatabase } from '../services/cardSync.service'
export default defineNitroPlugin(async (nitroApp) => {
const config = useRuntimeConfig()
const folderPath = config.PATH_FILES
const folderPath = process.env.NUXT_PATH_FILES
if (!folderPath) {
console.warn('⚠️ PATH_FILES non configuré')
console.warn('⚠️ NUXT_PATH_FILES non configuré')
return
}

View File

@@ -6,8 +6,7 @@ export default defineTask({
description: 'Synchronise les tracks avec le système de fichiers'
},
async run() {
const config = useRuntimeConfig()
const folderPath = config.PATH_FILES
const folderPath = process.env.NUXT_PATH_FILES
console.log('⏰ [TASK] Démarrage de la synchronisation planifiée...')

View File

@@ -10,7 +10,6 @@ const listImageExts = ['.jpg', '.jpeg', '.webp']
export async function scanMusicFolder(folderPath: string): Promise<Card[]> {
try {
const config = useRuntimeConfig()
const files = await readdir(folderPath)
const cardMap = new Map<string, Card>()
@@ -31,14 +30,14 @@ export async function scanMusicFolder(folderPath: string): Promise<Card[]> {
for (const imgExt of listImageExts) {
const potentialImage = baseName + imgExt
if (files.includes(potentialImage)) {
imageUrl = config.URL_PREFIX + baseName + imgExt
imageUrl = process.env.NUXT_URL_PREFIX + baseName + imgExt
break
}
}
cardMap.set(parsed.esid, {
...parsed,
url_audio: config.URL_PREFIX + baseName + ext,
url_audio: process.env.NUXT_URL_PREFIX + baseName + ext,
url_image: imageUrl,
suit: parsed.suit,
rank: parsed.rank