feat: implement DASHBOARD_ORIGIN for invite and email links, enhancing self-hosted configuration and updating related documentation
This commit is contained in:
@@ -0,0 +1,20 @@
|
||||
import { env } from './env';
|
||||
|
||||
/**
|
||||
* Returns the base URL for the dashboard app, used for invite links, email links, etc.
|
||||
* When DASHBOARD_ORIGIN is set (e.g. self-hosted), it takes precedence.
|
||||
* Otherwise: dev → localhost:5173, prod → app.classroomio.com (or subdomain for cloud).
|
||||
*/
|
||||
export function getDashboardBaseUrl(orgSiteName?: string): string {
|
||||
if (env.DASHBOARD_ORIGIN) {
|
||||
return env.DASHBOARD_ORIGIN.replace(/\/$/, '');
|
||||
}
|
||||
|
||||
if (env.NODE_ENV === 'development') {
|
||||
return 'http://localhost:5173';
|
||||
}
|
||||
|
||||
const subdomain = orgSiteName || 'app';
|
||||
|
||||
return `https://${subdomain}.classroomio.com`;
|
||||
}
|
||||
@@ -41,7 +41,9 @@ const envSchema = z.object({
|
||||
/** When 'true', instance runs in self-hosted mode: single org, auto-enroll as student, no org switching */
|
||||
PUBLIC_IS_SELFHOSTED: z.string().optional(),
|
||||
/** License key for enterprise features (SSO, token-auth, no-tracking, etc.) */
|
||||
LICENSE_KEY: z.string().optional()
|
||||
LICENSE_KEY: z.string().optional(),
|
||||
/** Dashboard origin for invite/email links (e.g. https://app.yourdomain.com). When set, all email links point here instead of app.classroomio.com. Required for self-hosted. */
|
||||
DASHBOARD_ORIGIN: z.string().optional()
|
||||
});
|
||||
|
||||
export const env = envSchema.parse(process.env);
|
||||
|
||||
Reference in New Issue
Block a user