diff --git a/src/config.ts b/src/config.ts new file mode 100644 index 0000000..9b8fecd --- /dev/null +++ b/src/config.ts @@ -0,0 +1,20 @@ +// Gatehouse Configuration +// Environment-specific settings for the application + +export const config = { + // API Configuration + api: { + baseUrl: import.meta.env.VITE_API_BASE_URL || '/api/v1', + }, + + // App metadata + app: { + name: 'Gatehouse', + description: 'Identity & Access Platform', + }, + + // Feature flags + features: { + devTools: import.meta.env.DEV, + }, +} as const; diff --git a/src/lib/api.ts b/src/lib/api.ts index a31f65b..b97e697 100644 --- a/src/lib/api.ts +++ b/src/lib/api.ts @@ -1,7 +1,7 @@ // API Client for Gatehouse Backend // Uses session-based authentication with cookies -const API_BASE = '/api/v1'; +import { config } from '@/config'; interface ApiResponse { version: string; @@ -58,7 +58,7 @@ async function request( endpoint: string, options: RequestInit = {} ): Promise { - const response = await fetch(`${API_BASE}${endpoint}`, { + const response = await fetch(`${config.api.baseUrl}${endpoint}`, { ...options, credentials: 'include', // Important: include session cookies headers: {