From dd0518bcd3e5ec7f178d8de77149a8248461517c Mon Sep 17 00:00:00 2001 From: 37b7 Date: Tue, 20 May 2025 09:10:36 +0200 Subject: [PATCH] mmh --- config/basePath.ts | 8 +------- docker/Dockerfile | 7 +------ nuxt.config.ts | 6 ------ plugins/router.ts | 4 ++-- 4 files changed, 4 insertions(+), 21 deletions(-) diff --git a/config/basePath.ts b/config/basePath.ts index 95a9950..5ca4044 100644 --- a/config/basePath.ts +++ b/config/basePath.ts @@ -1,13 +1,7 @@ import { useRuntimeConfig } from '#imports'; const getBasePath = (): string => { - try { - const config = useRuntimeConfig(); - return config.public.basePath; - } catch (e) { - console.error('Error getting base path:', e); - return process.env.NODE_ENV === 'production' ? process.env.BASE_PATH || '/' : '/'; - } + return process.env.NODE_ENV === 'production' ? process.env.BASE_PATH || '/' : '/'; }; diff --git a/docker/Dockerfile b/docker/Dockerfile index 0a66e83..b4fc5bf 100644 --- a/docker/Dockerfile +++ b/docker/Dockerfile @@ -1,11 +1,6 @@ FROM node:18-alpine as builder WORKDIR /app COPY package*.json ./ -ENV NODE_ENV=production -ENV BASE_PATH=/containers/matheothierry-portfolio_nuxt -ENV CDN_URL=https://codefirst.iut.uca.fr -ENV HOST=0.0.0.0 -ENV PORT=3000 RUN npm install COPY . . RUN npm run build @@ -18,7 +13,7 @@ COPY --from=builder /app/public ./public COPY --from=builder /app/.nuxt ./.nuxt RUN npm install --production ENV NODE_ENV=production -ENV BASE_PATH=/containers/matheothierry-portfolio_nuxt +ENV BASE_PATH=/ ENV CDN_URL=https://codefirst.iut.uca.fr ENV HOST=0.0.0.0 ENV PORT=3000 diff --git a/nuxt.config.ts b/nuxt.config.ts index a6bfec9..0f8fae2 100644 --- a/nuxt.config.ts +++ b/nuxt.config.ts @@ -62,10 +62,4 @@ export default defineNuxtConfig({ maxAge: 60 * 60 * 24 * 30 }, }, - - runtimeConfig: { - public: { - basePath: process.env.NODE_ENV === 'production' ? process.env.BASE_PATH : '/' - } - } }) \ No newline at end of file diff --git a/plugins/router.ts b/plugins/router.ts index 580d323..51b105a 100644 --- a/plugins/router.ts +++ b/plugins/router.ts @@ -4,8 +4,8 @@ export default defineNuxtPlugin({ setup(nuxtApp) { nuxtApp.hook('app:error', (error) => { if (error.statusCode === 404 && process.client) { - const basePath = process.env.NODE_ENV === 'production' ? '/containers/matheothierry-portfolio_nuxt' : '/' - error.path = window.location.pathname.replace(basePath, '') + const basePath = process.env.NODE_ENV === 'production' ? process.env.BASE_PATH : '/' + error.path = window.location.pathname.replace(basePath as string, '') } })