diff --git a/apps/infoalloggi/Dockerfile b/apps/infoalloggi/Dockerfile index 3a12597..9716600 100644 --- a/apps/infoalloggi/Dockerfile +++ b/apps/infoalloggi/Dockerfile @@ -27,7 +27,8 @@ ENV SKIP_REDIS="true" # Only essential build-time variables ARG BASE_URL ENV BASE_URL=$BASE_URL -ENV NEXT_PUBLIC_BASE_URL=$BASE_URL +ARG NEXT_PUBLIC_BASE_URL +ENV NEXT_PUBLIC_BASE_URL=$NEXT_PUBLIC_BASE_URL ARG NEXT_PUBLIC_STRIPE_PUBLIC_KEY ENV NEXT_PUBLIC_STRIPE_PUBLIC_KEY=$NEXT_PUBLIC_STRIPE_PUBLIC_KEY @@ -50,7 +51,6 @@ ENV POSTGRES_PASSWORD=$POSTGRES_PASSWORD # Mock/empty values for validation bypass during build ENV JWT_SECRET="build-time-mock" ENV BACKENDSERVER_URL="http://backend:1323" -ENV SENDGRID_API_KEY="mock" ENV STRIPE_SECRET_KEY="mock" ENV STRIPE_WEBHOOK_SECRET="mock" ENV FIC_CLIENT_ID="mock" @@ -84,7 +84,8 @@ ENV SKIP_REDIS="false" # Essential runtime variables ARG BASE_URL ENV BASE_URL=$BASE_URL -ENV NEXT_PUBLIC_BASE_URL=$BASE_URL +ARG NEXT_PUBLIC_BASE_URL +ENV NEXT_PUBLIC_BASE_URL=$NEXT_PUBLIC_BASE_URL ARG INTERNAL_BASE_URL ENV INTERNAL_BASE_URL=$INTERNAL_BASE_URL ARG POSTGRES_USER @@ -101,8 +102,6 @@ ARG JWT_SECRET ENV JWT_SECRET=$JWT_SECRET ARG BACKENDSERVER_URL ENV BACKENDSERVER_URL=$BACKENDSERVER_URL -ARG SENDGRID_API_KEY -ENV SENDGRID_API_KEY=$SENDGRID_API_KEY ARG STRIPE_SECRET_KEY ENV STRIPE_SECRET_KEY=$STRIPE_SECRET_KEY ARG NEXT_PUBLIC_STRIPE_PUBLIC_KEY diff --git a/apps/infoalloggi/dev-docker-compose.yml b/apps/infoalloggi/dev-docker-compose.yml index c2fcefc..b138325 100644 --- a/apps/infoalloggi/dev-docker-compose.yml +++ b/apps/infoalloggi/dev-docker-compose.yml @@ -13,7 +13,6 @@ services: BACKENDSERVER_URL: http://host.docker.internal:1323 TILES_URL: host.docker.internal:6379 KEYDB_URL: host.docker.internal:6380 - SENDGRID_API_KEY: ${SENDGRID_API_KEY} STRIPE_SECRET_KEY: ${STRIPE_SECRET_KEY} NEXT_PUBLIC_STRIPE_PUBLIC_KEY: ${NEXT_PUBLIC_STRIPE_PUBLIC_KEY} STRIPE_WEBHOOK_SECRET: ${STRIPE_WEBHOOK_SECRET} @@ -38,7 +37,6 @@ services: BACKENDSERVER_URL: http://host.docker.internal:1323 TILES_URL: host.docker.internal:6379 KEYDB_URL: host.docker.internal:638 - SENDGRID_API_KEY: ${SENDGRID_API_KEY} STRIPE_SECRET_KEY: ${STRIPE_SECRET_KEY} NEXT_PUBLIC_STRIPE_PUBLIC_KEY: ${NEXT_PUBLIC_STRIPE_PUBLIC_KEY} STRIPE_WEBHOOK_SECRET: ${STRIPE_WEBHOOK_SECRET} diff --git a/apps/infoalloggi/src/env.ts b/apps/infoalloggi/src/env.ts index 397df67..fcd8549 100644 --- a/apps/infoalloggi/src/env.ts +++ b/apps/infoalloggi/src/env.ts @@ -33,9 +33,7 @@ export const env = createEnv({ NEXT_PUBLIC_BASE_URL: z.string(), NEXT_PUBLIC_STRIPE_PUBLIC_KEY: z.string(), }, - shared: { - NEXT_PUBLIC_BASE_URL: z.string(), - }, + // If you're using Next.js < 13.4.4, you'll need to specify the runtimeEnv manually experimental__runtimeEnv: { NEXT_PUBLIC_BASE_URL: process.env.NEXT_PUBLIC_BASE_URL, diff --git a/apps/infoalloggi/src/server/api/routers/interests.ts b/apps/infoalloggi/src/server/api/routers/interests.ts index 385fe69..bdb136d 100644 --- a/apps/infoalloggi/src/server/api/routers/interests.ts +++ b/apps/infoalloggi/src/server/api/routers/interests.ts @@ -52,7 +52,7 @@ export const intrestsRouter = createTRPCRouter({ mailType: "generic", props: { link: { - href: `${env.NEXT_PUBLIC_BASE_URL}/area-riservata/admin/user-view/ricerca/${userId}`, + href: `${env.BASE_URL}/area-riservata/admin/user-view/ricerca/${userId}`, label: "Visualizza utente", }, testo: `L'utente ${user.username} (${user.email}) ha mostrato interesse per l'annuncio "${annuncio.titolo_it}" (Codice: ${annuncio.codice}).`, diff --git a/apps/infoalloggi/src/server/controllers/annunci.controller.ts b/apps/infoalloggi/src/server/controllers/annunci.controller.ts index c066d9f..1d4471c 100644 --- a/apps/infoalloggi/src/server/controllers/annunci.controller.ts +++ b/apps/infoalloggi/src/server/controllers/annunci.controller.ts @@ -106,13 +106,13 @@ export const getAnnunciMetaByCod = async ({ cod }: { cod: string }) => { annuncio.url_immagini && annuncio.url_immagini.length > 0 && annuncio.url_immagini[0] - ? `${env.NEXT_PUBLIC_BASE_URL}/go-api/images/get/${annuncio.url_immagini[0]}` + ? `${env.BASE_URL}/go-api/images/get/${annuncio.url_immagini[0]}` : annuncio.og_url || ""; return { description: annuncio.desc_it || "", ogImage, - ogUrl: `${env.NEXT_PUBLIC_BASE_URL}/annuncio/${cod}`, + ogUrl: `${env.BASE_URL}/annuncio/${cod}`, title: annuncio.titolo_it || "", }; } catch (e) { diff --git a/apps/infoalloggi/src/server/controllers/servizio.controller.ts b/apps/infoalloggi/src/server/controllers/servizio.controller.ts index c2d7980..d8f8e63 100644 --- a/apps/infoalloggi/src/server/controllers/servizio.controller.ts +++ b/apps/infoalloggi/src/server/controllers/servizio.controller.ts @@ -1155,12 +1155,6 @@ export const sendServizioEmail = async ({ .where("servizio_annunci.servizio_id", "=", servizioId) .execute(); - console.log("=== EMAIL DEBUG ==="); - console.log("BASE_URL:", env.BASE_URL); - console.log("INTERNAL_BASE_URL:", env.INTERNAL_BASE_URL); - console.log("NEXT_PUBLIC_BASE_URL:", env.NEXT_PUBLIC_BASE_URL); - console.log("=================="); - const { email, nome } = user; await NewMail({ mailType: "onboardingServizio", diff --git a/apps/infoalloggi/src/server/controllers/stripe.controller.ts b/apps/infoalloggi/src/server/controllers/stripe.controller.ts index e83b9fd..6e994a9 100644 --- a/apps/infoalloggi/src/server/controllers/stripe.controller.ts +++ b/apps/infoalloggi/src/server/controllers/stripe.controller.ts @@ -139,7 +139,7 @@ export const whIntentSucceededHandler = async ({ props: { link: { - href: `${env.NEXT_PUBLIC_BASE_URL}/area-riservata/payment-recap/${ordine.ordine_id}`, + href: `${env.BASE_URL}/area-riservata/payment-recap/${ordine.ordine_id}`, label: "Vai alla ricevuta", }, noreply: true, @@ -166,7 +166,7 @@ export const whIntentSucceededHandler = async ({ mailType: "generic", props: { link: { - href: `${env.NEXT_PUBLIC_BASE_URL}/area-riservata/payment-recap/${ordine.ordine_id}`, + href: `${env.BASE_URL}/area-riservata/payment-recap/${ordine.ordine_id}`, label: "Vai alla ricevuta", }, noreply: true, @@ -190,7 +190,7 @@ export const whIntentSucceededHandler = async ({ mailType: "generic", props: { link: { - href: `${env.NEXT_PUBLIC_BASE_URL}/area-riservata/payment-recap/${ordine.ordine_id}`, + href: `${env.BASE_URL}/area-riservata/payment-recap/${ordine.ordine_id}`, label: "Vai alla ricevuta", }, noreply: true, @@ -207,7 +207,7 @@ export const whIntentSucceededHandler = async ({ await NewMail({ mailType: "pagamentoConferma", props: { - receiptHref: `${env.NEXT_PUBLIC_BASE_URL}/area-riservata/payment-recap/${ordine.ordine_id}`, + receiptHref: `${env.BASE_URL}/area-riservata/payment-recap/${ordine.ordine_id}`, }, subject: "Pagamento Confermato", to: utente.email, @@ -251,7 +251,7 @@ export const whIntentFailedHandler = async ({ to: utente.email, userId: utente.id, props: { - baseUrl: env.NEXT_PUBLIC_BASE_URL, + baseUrl: env.BASE_URL, }, }); } diff --git a/apps/infoalloggi/src/server/services/auth.service.ts b/apps/infoalloggi/src/server/services/auth.service.ts index 8ec7d46..bea889a 100644 --- a/apps/infoalloggi/src/server/services/auth.service.ts +++ b/apps/infoalloggi/src/server/services/auth.service.ts @@ -117,7 +117,7 @@ export const pwResetSendLinkHandler = async ({ email }: { email: string }) => { await NewMail({ mailType: "pwResetLink", props: { - resetlink: `${env.NEXT_PUBLIC_BASE_URL}/auth/password-reset/${token}`, + resetlink: `${env.BASE_URL}/auth/password-reset/${token}`, }, subject: `Richiesta di reset password Infoalloggi.it`, to: email, diff --git a/ref-docker-compose.yml b/ref-docker-compose.yml index f20e911..ca35951 100644 --- a/ref-docker-compose.yml +++ b/ref-docker-compose.yml @@ -130,6 +130,7 @@ services: KEYDB_URL: keydb:6379 TILES_URL: tiles:6379 BASE_URL: ${BASE_URL} + NEXT_PUBLIC_BASE_URL: ${BASE_URL} SENDGRID_API_KEY: ${SENDGRID_API_KEY} STRIPE_SECRET_KEY: ${STRIPE_SECRET_KEY} NEXT_PUBLIC_STRIPE_PUBLIC_KEY: ${NEXT_PUBLIC_STRIPE_PUBLIC_KEY}