Add contributing guidelines, feature flag utilities, and route integrity tests

This commit is contained in:
Your Name
2026-03-10 10:58:21 +02:00
parent d5e6df42d3
commit 0be708a8d1
4 changed files with 272 additions and 0 deletions

View File

@@ -0,0 +1,23 @@
/**
* Feature flag utilities for the frontend.
*
* Feature flags are read from VITE_FEATURE_* environment variables.
* When a flag is absent or set to "true", the feature is ENABLED (opt-out model).
* Set a flag to "false" to disable a feature.
*
* Usage:
* import { isFeatureEnabled } from '@/config/featureFlags';
* if (isFeatureEnabled('EDITOR')) { ... }
*/
type FeatureName = 'EDITOR' | 'OCR' | 'REMOVEBG';
/**
* Check whether a feature is enabled.
* Defaults to `true` if the env var is not set.
*/
export function isFeatureEnabled(feature: FeatureName): boolean {
const value = import.meta.env[`VITE_FEATURE_${feature}`];
if (value === undefined || value === '') return true; // enabled by default
return value.toLowerCase() !== 'false';
}