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

@@ -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 {
endpoint: string;
query?: Record<string, string>;
@@ -22,8 +32,7 @@ interface Props {
if (endpoint.startsWith('/')) {
endpoint = endpoint.slice(1);
}
const strapiUrl = import.meta.env.STRAPI_URL || process.env.STRAPI_URL || "http://localhost:1337";
console.log(strapiUrl);
const strapiUrl = getStrapiBaseUrl();
const url = new URL(`${strapiUrl}/api/${endpoint}`);
if (query) {