All checks were successful
Deploy to Test Environment / deploy-to-test (push) Successful in 22m13s
52 lines
2.1 KiB
TypeScript
52 lines
2.1 KiB
TypeScript
// src/config.ts
|
|
|
|
/**
|
|
* A centralized configuration module that reads environment variables
|
|
* from `import.meta.env`. This provides a single, explicit place to manage
|
|
* environment-specific settings and makes mocking for tests significantly easier.
|
|
*/
|
|
const config = {
|
|
app: {
|
|
version: import.meta.env.VITE_APP_VERSION,
|
|
commitMessage: import.meta.env.VITE_APP_COMMIT_MESSAGE,
|
|
commitUrl: import.meta.env.VITE_APP_COMMIT_URL,
|
|
},
|
|
google: {
|
|
mapsEmbedApiKey: import.meta.env.VITE_GOOGLE_MAPS_EMBED_API_KEY,
|
|
},
|
|
/**
|
|
* Sentry/Bugsink error tracking configuration (ADR-015).
|
|
* Uses VITE_ prefix for client-side environment variables.
|
|
*/
|
|
sentry: {
|
|
dsn: import.meta.env.VITE_SENTRY_DSN,
|
|
environment: import.meta.env.VITE_SENTRY_ENVIRONMENT || import.meta.env.MODE,
|
|
debug: import.meta.env.VITE_SENTRY_DEBUG === 'true',
|
|
enabled: import.meta.env.VITE_SENTRY_ENABLED !== 'false',
|
|
},
|
|
/**
|
|
* Feature flags for conditional feature rendering (ADR-024).
|
|
*
|
|
* All flags default to false (disabled) when the environment variable is not set
|
|
* or is set to any value other than 'true'. This opt-in model ensures features
|
|
* are explicitly enabled, preventing accidental exposure of incomplete features.
|
|
*
|
|
* Environment variables follow the naming convention: VITE_FEATURE_SNAKE_CASE
|
|
* Config properties use camelCase for consistency with JavaScript conventions.
|
|
*
|
|
* @see docs/adr/0024-feature-flagging-strategy.md
|
|
*/
|
|
featureFlags: {
|
|
/** Enable the redesigned dashboard UI (VITE_FEATURE_NEW_DASHBOARD) */
|
|
newDashboard: import.meta.env.VITE_FEATURE_NEW_DASHBOARD === 'true',
|
|
/** Enable beta recipe features (VITE_FEATURE_BETA_RECIPES) */
|
|
betaRecipes: import.meta.env.VITE_FEATURE_BETA_RECIPES === 'true',
|
|
/** Enable experimental AI features (VITE_FEATURE_EXPERIMENTAL_AI) */
|
|
experimentalAi: import.meta.env.VITE_FEATURE_EXPERIMENTAL_AI === 'true',
|
|
/** Enable debug mode UI elements (VITE_FEATURE_DEBUG_MODE) */
|
|
debugMode: import.meta.env.VITE_FEATURE_DEBUG_MODE === 'true',
|
|
},
|
|
};
|
|
|
|
export default config;
|