feat: use environment variable for uploads directory path
All checks were successful
Build Docker Image / build (push) Successful in 1m26s
All checks were successful
Build Docker Image / build (push) Successful in 1m26s
This commit is contained in:
@@ -6,6 +6,7 @@ import type { PageServerLoad, Actions } from './$types';
|
||||
import { writeFile } from 'fs/promises';
|
||||
import { join } from 'path';
|
||||
import { existsSync, mkdirSync } from 'fs';
|
||||
import { env } from '$env/dynamic/private';
|
||||
|
||||
export const load: PageServerLoad = async () => {
|
||||
const [charactersData, devilFruits, arcs, overrides] = await Promise.all([
|
||||
@@ -109,7 +110,7 @@ export const actions: Actions = {
|
||||
const hasUploadedPicture = !!pictureFile && pictureFile.size > 0;
|
||||
if (hasUploadedPicture) {
|
||||
try {
|
||||
const uploadsDir = join(process.cwd(), 'uploads');
|
||||
const uploadsDir = join(process.cwd(), env.UPLOAD_FOLDER || 'uploads');
|
||||
if (!existsSync(uploadsDir)) {
|
||||
mkdirSync(uploadsDir, { recursive: true });
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user