try fix CI
This commit is contained in:
5
.env
5
.env
@@ -1,10 +1,5 @@
|
|||||||
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
|
ENABLE_WATCHER=true
|
||||||
|
|||||||
@@ -5,8 +5,9 @@ const isProd = process.env.NODE_ENV === 'production'
|
|||||||
|
|
||||||
export default defineNuxtConfig({
|
export default defineNuxtConfig({
|
||||||
runtimeConfig: {
|
runtimeConfig: {
|
||||||
pathFiles: process.env.PATH_FILES,
|
PATH_FILES: 'mnt/media/files/music',
|
||||||
pathDb: process.env.PATH_DB
|
PATH_DB: 'data/music.db',
|
||||||
|
URL_PREFIX: 'https://files.erudi.fr/music/'
|
||||||
},
|
},
|
||||||
nitro: {
|
nitro: {
|
||||||
experimental: {
|
experimental: {
|
||||||
|
|||||||
@@ -2,7 +2,7 @@ import { syncCardsWithDatabase } from '../services/cardSync.service'
|
|||||||
|
|
||||||
export default defineEventHandler(async (event) => {
|
export default defineEventHandler(async (event) => {
|
||||||
const config = useRuntimeConfig()
|
const config = useRuntimeConfig()
|
||||||
const folderPath = config.pathFiles || process.env.PATH_FILES
|
const folderPath = config.PATH_FILES
|
||||||
|
|
||||||
if (!folderPath) {
|
if (!folderPath) {
|
||||||
throw createError({
|
throw createError({
|
||||||
|
|||||||
@@ -2,7 +2,7 @@ import { syncCardsWithDatabase } from '../../services/cardSync.service'
|
|||||||
|
|
||||||
export default defineEventHandler(async (event) => {
|
export default defineEventHandler(async (event) => {
|
||||||
const config = useRuntimeConfig()
|
const config = useRuntimeConfig()
|
||||||
const folderPath = config.pathFiles || process.env.PATH_FILES || 'mnt/media/files/music'
|
const folderPath = config.PATH_FILES
|
||||||
|
|
||||||
try {
|
try {
|
||||||
const result = await syncCardsWithDatabase(folderPath)
|
const result = await syncCardsWithDatabase(folderPath)
|
||||||
|
|||||||
@@ -2,7 +2,7 @@ import { scanMusicFolder } from '../../utils/fileScanner'
|
|||||||
|
|
||||||
export default defineEventHandler(async (event) => {
|
export default defineEventHandler(async (event) => {
|
||||||
const config = useRuntimeConfig()
|
const config = useRuntimeConfig()
|
||||||
const folderPath = config.pathFiles || process.env.PATH_FILES || 'mnt/media/files/music'
|
const folderPath = config.PATH_FILES
|
||||||
|
|
||||||
try {
|
try {
|
||||||
// Test 1: Vérifier que le dossier existe
|
// Test 1: Vérifier que le dossier existe
|
||||||
|
|||||||
@@ -7,7 +7,7 @@ export function useDB() {
|
|||||||
if (_db) return _db
|
if (_db) return _db
|
||||||
|
|
||||||
const config = useRuntimeConfig()
|
const config = useRuntimeConfig()
|
||||||
let dbPath = config.pathDb || process.env.PATH_DB
|
let dbPath = config.PATH_DB
|
||||||
|
|
||||||
if (!dbPath) {
|
if (!dbPath) {
|
||||||
throw new Error('PATH_DB is not configured')
|
throw new Error('PATH_DB is not configured')
|
||||||
|
|||||||
@@ -2,7 +2,7 @@ import { syncCardsWithDatabase } from '../services/cardSync.service'
|
|||||||
|
|
||||||
export default defineNitroPlugin(async (nitroApp) => {
|
export default defineNitroPlugin(async (nitroApp) => {
|
||||||
const config = useRuntimeConfig()
|
const config = useRuntimeConfig()
|
||||||
const folderPath = config.pathFiles || process.env.PATH_FILES
|
const folderPath = config.PATH_FILES
|
||||||
|
|
||||||
if (!folderPath) {
|
if (!folderPath) {
|
||||||
console.warn('⚠️ PATH_FILES non configuré')
|
console.warn('⚠️ PATH_FILES non configuré')
|
||||||
|
|||||||
@@ -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 = config.PATH_FILES
|
||||||
|
|
||||||
console.log('⏰ [TASK] Démarrage de la synchronisation planifiée...')
|
console.log('⏰ [TASK] Démarrage de la synchronisation planifiée...')
|
||||||
|
|
||||||
|
|||||||
@@ -10,6 +10,7 @@ const listImageExts = ['.jpg', '.jpeg', '.webp']
|
|||||||
|
|
||||||
export async function scanMusicFolder(folderPath: string): Promise<Card[]> {
|
export async function scanMusicFolder(folderPath: string): Promise<Card[]> {
|
||||||
try {
|
try {
|
||||||
|
const config = useRuntimeConfig()
|
||||||
const files = await readdir(folderPath)
|
const files = await readdir(folderPath)
|
||||||
const cardMap = new Map<string, Card>()
|
const cardMap = new Map<string, Card>()
|
||||||
|
|
||||||
@@ -30,14 +31,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 = config.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: config.URL_PREFIX + baseName + ext,
|
||||||
url_image: imageUrl,
|
url_image: imageUrl,
|
||||||
suit: parsed.suit,
|
suit: parsed.suit,
|
||||||
rank: parsed.rank
|
rank: parsed.rank
|
||||||
|
|||||||
Reference in New Issue
Block a user