mirror of
https://github.com/jakejarvis/sofa.git
synced 2026-08-29 06:15:39 -04:00
Support self-hosted OIDC providers (Authentik, Authelia, Keycloak, etc.) configured entirely via environment variables. Uses Better Auth's hooks.before to gate email/password sign-up at the endpoint level, and disables emailAndPassword entirely when DISABLE_PASSWORD_LOGIN is set. Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
29 lines
740 B
TypeScript
29 lines
740 B
TypeScript
/**
|
|
* Server-side configuration checks.
|
|
* Call these in route handlers or server components — never on the client.
|
|
*/
|
|
|
|
export function isTmdbConfigured(): boolean {
|
|
return !!process.env.TMDB_API_READ_ACCESS_TOKEN;
|
|
}
|
|
|
|
export function isOidcConfigured(): boolean {
|
|
return !!(
|
|
process.env.OIDC_CLIENT_ID &&
|
|
process.env.OIDC_CLIENT_SECRET &&
|
|
process.env.OIDC_ISSUER_URL
|
|
);
|
|
}
|
|
|
|
export function getOidcProviderName(): string {
|
|
return process.env.OIDC_PROVIDER_NAME || "SSO";
|
|
}
|
|
|
|
export function isOidcAutoRegisterEnabled(): boolean {
|
|
return process.env.OIDC_AUTO_REGISTER !== "false";
|
|
}
|
|
|
|
export function isPasswordLoginDisabled(): boolean {
|
|
return process.env.DISABLE_PASSWORD_LOGIN === "true" && isOidcConfigured();
|
|
}
|