34 lines
1.4 KiB
TypeScript
34 lines
1.4 KiB
TypeScript
import { envRequired, getCurrentEnvironment } from '@/utils/environment';
|
|
|
|
export const IS_DEBUG = process.env.NEXT_PUBLIC_DEBUG === 'true'; // Enables logging, etc.
|
|
|
|
export const IS_PRODUCTION = getCurrentEnvironment() === 'production'; // Enables analytics, etc.
|
|
|
|
// export const PUBLIC_URL = envRequired(process.env.NEXT_PUBLIC_PUBLIC_URL); // Variant 1: .env variable is required
|
|
export const PUBLIC_URL = process.env.NEXT_PUBLIC_PUBLIC_URL; // Variant 2: .env variable is optional
|
|
|
|
export const API_URL = envRequired(process.env.NEXT_PUBLIC_API_URL);
|
|
|
|
/**
|
|
* The public web origin (no trailing slash), used only for absolute-URL metadata (OG tags,
|
|
* `metadataBase`, `robots.ts`/`sitemap.ts`) — never for API calls. Falls back to localhost so
|
|
* dev/CI keep working without the env var set; set it for real in production.
|
|
*/
|
|
export const SITE_URL = (process.env.NEXT_PUBLIC_SITE_URL || 'http://localhost:3000').replace(/\/$/, '');
|
|
|
|
/**
|
|
* The Neshan **web** key (client-embeddable maps/search), separate from the server's
|
|
* `NeshanGeocoder` server key (refinement phase 8). Optional — `AddressMapPicker` falls back to
|
|
* the bounded-canvas grid stand-in when unset, so dev/CI/jsdom keep working without it.
|
|
*/
|
|
export const NESHAN_WEB_KEY = process.env.NEXT_PUBLIC_NESHAN_KEY || undefined;
|
|
|
|
IS_DEBUG &&
|
|
console.log('@/config', {
|
|
IS_DEBUG,
|
|
IS_PRODUCTION,
|
|
PUBLIC_URL,
|
|
API_URL,
|
|
NESHAN_WEB_KEY: NESHAN_WEB_KEY ? '(set)' : undefined,
|
|
});
|