Files
community-rule/lib/privacyPolicyEnabled.ts
T
adilallo 81ad287c24 Keep /privacy off unless the runtime flag is on, and show that link in the footer story.
A build-time public env value was enough to publish the page, and the footer interaction story still looked for a link the component hides by default.
2026-11-20 15:40:05 -07:00

16 lines
585 B
TypeScript

/**
* `/privacy` stays off until university counsel has read the policy.
* Only the runtime switch `ENABLE_PRIVACY_POLICY=true` turns it on.
* A build-time `NEXT_PUBLIC_ENABLE_PRIVACY_POLICY` value does not.
* Unset or any other value is off.
*/
export function isPrivacyPolicyEnabled(): boolean {
return process.env.ENABLE_PRIVACY_POLICY === "true";
}
/** Absolute /privacy URL, or null while the flag is off. */
export function privacyPolicyUrl(origin: string): string | null {
if (!isPrivacyPolicyEnabled()) return null;
return `${origin.replace(/\/$/, "")}/privacy`;
}