deploy stuff, envs

This commit is contained in:
2025-06-22 06:46:44 +02:00
parent d31b0275e5
commit a55b248e1b
5 changed files with 16 additions and 8 deletions

View File

@@ -20,7 +20,7 @@ COPY --from=prod-deps /app/node_modules ./node_modules
COPY --from=build /app/dist ./dist COPY --from=build /app/dist ./dist
ENV HOST=0.0.0.0 ENV HOST=0.0.0.0
ENV PORT=4321 ENV PORT=4123
EXPOSE 4321 EXPOSE 4123
CMD node ./dist/server/entry.mjs CMD node ./dist/server/entry.mjs

View File

@@ -20,8 +20,8 @@ services:
- ./astro.config.mjs:/opt/app/astro.config.mjs - ./astro.config.mjs:/opt/app/astro.config.mjs
- ./tsconfig.json:/opt/app/tsconfig.json - ./tsconfig.json:/opt/app/tsconfig.json
networks: networks:
- strapi-network - pole-book_strapi-network
networks: networks:
strapi-network: pole-book_strapi-network:
external: true external: true

View File

@@ -18,7 +18,6 @@ const BASE_URL = getStrapiBaseUrl();
<div {...otherProps}> <div {...otherProps}>
{ {
elements.map((poleElement) => ( elements.map((poleElement) => (
console.log(poleElement),
<a href={`/elements/${poleElement.id}`} class="block"> <a href={`/elements/${poleElement.id}`} class="block">
<article class="flex items-center bg-white rounded-lg shadow-lg overflow-hidden hover:shadow-xl transition-shadow duration-200"> <article class="flex items-center bg-white rounded-lg shadow-lg overflow-hidden hover:shadow-xl transition-shadow duration-200">
<img <img

View File

@@ -1,6 +1,6 @@
// Global Strapi configuration // Global Strapi configuration
export const STRAPI_CONFIG = { export const STRAPI_CONFIG = {
BASE_URL: (import.meta.env.STRAPI_URL as string) || "http://localhost:1337", BASE_URL: (import.meta.env.STRAPI_URL as string) || (process.env.STRAPI_URL as string) || "http://localhost:1337",
} as const; } as const;
// Helper function to get the base URL // Helper function to get the base URL

View File

@@ -1,3 +1,13 @@
// Global Strapi configuration
export const STRAPI_CONFIG = {
BASE_URL: (import.meta.env.STRAPI_URL as string) || (process.env.STRAPI_URL as string) || "http://localhost:1337",
} as const;
// Helper function to get the base URL
export function getStrapiBaseUrl(): string {
return STRAPI_CONFIG.BASE_URL;
}
interface Props { interface Props {
endpoint: string; endpoint: string;
query?: Record<string, string>; query?: Record<string, string>;
@@ -22,8 +32,7 @@ interface Props {
if (endpoint.startsWith('/')) { if (endpoint.startsWith('/')) {
endpoint = endpoint.slice(1); endpoint = endpoint.slice(1);
} }
const strapiUrl = import.meta.env.STRAPI_URL || process.env.STRAPI_URL || "http://localhost:1337"; const strapiUrl = getStrapiBaseUrl();
console.log(strapiUrl);
const url = new URL(`${strapiUrl}/api/${endpoint}`); const url = new URL(`${strapiUrl}/api/${endpoint}`);
if (query) { if (query) {