test server NUXT_ env
All checks were successful
Deploy App / build (push) Successful in 1m2s
Deploy App / deploy (push) Successful in 18s

This commit is contained in:
valere
2026-02-10 20:33:10 +01:00
parent 7be09dd12d
commit d89f2aa3e7
11 changed files with 15 additions and 26 deletions

10
.env
View File

@@ -1,10 +1,8 @@
DOMAIN=evilspins.com DOMAIN=evilspins.com
PORT=7901 PORT=7901
PORT_EXPOSED=3000 PORT_EXPOSED=3000
PATH_FILES=mnt/media/files/music
PATH_DB=data/music.db
EXT_TRACK=mp3
EXT_COVER=jpg
URL_PREFIX=https://files.erudi.fr/music/
NODE_ENV=production NODE_ENV=production
ENABLE_WATCHER=true
NUXT_PATH_FILES=mnt/media/files/music
NUXT_PATH_DB=data/music.db
NUXT_URL_PREFIX=https://files.erudi.fr/music/

Binary file not shown.

View File

@@ -6,6 +6,6 @@ export default defineConfig({
schema: './server/db/schema.ts', schema: './server/db/schema.ts',
dialect: 'sqlite', dialect: 'sqlite',
dbCredentials: { dbCredentials: {
url: process.env.PATH_DB! url: process.env.NUXT_PATH_DB!
} }
}) })

View File

@@ -4,10 +4,6 @@ import tsconfigPaths from 'vite-tsconfig-paths'
const isProd = process.env.NODE_ENV === 'production' const isProd = process.env.NODE_ENV === 'production'
export default defineNuxtConfig({ export default defineNuxtConfig({
runtimeConfig: {
pathFiles: process.env.PATH_FILES,
pathDb: process.env.PATH_DB
},
nitro: { nitro: {
experimental: { experimental: {
tasks: true tasks: true

View File

@@ -1,13 +1,12 @@
import { syncCardsWithDatabase } from '../services/cardSync.service' import { syncCardsWithDatabase } from '../services/cardSync.service'
export default defineEventHandler(async (event) => { export default defineEventHandler(async (event) => {
const config = useRuntimeConfig() const folderPath = process.env.NUXT_PATH_FILES
const folderPath = config.pathFiles || process.env.PATH_FILES
if (!folderPath) { if (!folderPath) {
throw createError({ throw createError({
statusCode: 500, 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' import { syncCardsWithDatabase } from '../../services/cardSync.service'
export default defineEventHandler(async (event) => { export default defineEventHandler(async (event) => {
const config = useRuntimeConfig() const folderPath = process.env.NUXT_PATH_FILES
const folderPath = config.pathFiles || process.env.PATH_FILES || 'mnt/media/files/music'
try { try {
const result = await syncCardsWithDatabase(folderPath) const result = await syncCardsWithDatabase(folderPath)

View File

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

View File

@@ -6,8 +6,7 @@ let _db: ReturnType<typeof drizzle> | null = null
export function useDB() { export function useDB() {
if (_db) return _db if (_db) return _db
const config = useRuntimeConfig() let dbPath = process.env.NUXT_PATH_DB
let dbPath = config.pathDb || process.env.PATH_DB
if (!dbPath) { if (!dbPath) {
throw new Error('PATH_DB is not configured') throw new Error('PATH_DB is not configured')

View File

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

View File

@@ -7,7 +7,7 @@ export default defineTask({
}, },
async run() { async run() {
const config = useRuntimeConfig() const config = useRuntimeConfig()
const folderPath = config.pathFiles || process.env.PATH_FILES || 'mnt/media/files/music' const folderPath = process.env.NUXT_PATH_FILES
console.log('⏰ [TASK] Démarrage de la synchronisation planifiée...') console.log('⏰ [TASK] Démarrage de la synchronisation planifiée...')

View File

@@ -30,14 +30,14 @@ export async function scanMusicFolder(folderPath: string): Promise<Card[]> {
for (const imgExt of listImageExts) { for (const imgExt of listImageExts) {
const potentialImage = baseName + imgExt const potentialImage = baseName + imgExt
if (files.includes(potentialImage)) { if (files.includes(potentialImage)) {
imageUrl = process.env.URL_PREFIX + baseName + imgExt imageUrl = process.env.NUXT_URL_PREFIX + baseName + imgExt
break break
} }
} }
cardMap.set(parsed.esid, { cardMap.set(parsed.esid, {
...parsed, ...parsed,
url_audio: process.env.URL_PREFIX + baseName + ext, url_audio: process.env.NUXT_URL_PREFIX + baseName + ext,
url_image: imageUrl, url_image: imageUrl,
suit: parsed.suit, suit: parsed.suit,
rank: parsed.rank rank: parsed.rank