Files
community-rule/lib/privacyPolicyEnabled.ts
T

18 lines
604 B
TypeScript

/**
* `/privacy` stays off in production until university counsel has read the
* policy. Staging sets `ENABLE_PRIVACY_POLICY=true` (or the public alias).
* Unset or any other value is off.
*/
export function isPrivacyPolicyEnabled(): boolean {
return (
process.env.ENABLE_PRIVACY_POLICY === "true" ||
process.env.NEXT_PUBLIC_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`;
}