chore: move IS_SELFHOSTED to public env

This commit is contained in:
Rotimi Best
2025-09-07 10:24:34 +01:00
parent f7a66f851f
commit 9055c45384
8 changed files with 15 additions and 14 deletions
+2 -2
View File
@@ -7,7 +7,7 @@ import { ROLE } from '$lib/utils/constants/roles';
import { STEPS } from '../constants/quiz';
import type { UserLessonDataType } from '$lib/utils/types';
import type { Writable } from 'svelte/store';
import { env } from '$env/dynamic/public';
import { PUBLIC_IS_SELFHOSTED } from '$env/static/public';
// Trigger build
export const defaultCurrentOrgState: CurrentOrg = {
@@ -70,7 +70,7 @@ export const currentOrgDomain = derived(currentOrg, ($currentOrg) => {
});
export const isFreePlan = derived(currentOrg, ($currentOrg) => {
if (!$currentOrg.id || env.IS_SELFHOSTED === 'true') return false;
if (!$currentOrg.id || PUBLIC_IS_SELFHOSTED === 'true') return false;
const plan = getActivePlan($currentOrg);
+6 -5
View File
@@ -1,7 +1,7 @@
import { getSupabase, supabase } from '$lib/utils/functions/supabase';
import type { CurrentOrg } from '$lib/utils/types/org';
import { IS_SELFHOSTED } from '$env/static/private';
import { PUBLIC_IS_SELFHOSTED } from '$env/static/public';
import type { MetaTagsProps } from 'svelte-meta-tags';
import { blockedSubdomain } from '$lib/utils/constants/app';
import { dev } from '$app/environment';
@@ -13,7 +13,7 @@ if (!supabase) {
getSupabase();
}
export const ssr = IS_SELFHOSTED === 'true' ? false : true;
export const ssr = PUBLIC_IS_SELFHOSTED === 'true' ? false : true;
interface LoadOutput {
orgSiteName: string;
@@ -36,10 +36,10 @@ export const load = async ({ url, cookies, request }): Promise<LoadOutput> => {
serverLang: request.headers?.get('accept-language') || ''
};
console.log('IS_SELFHOSTED', IS_SELFHOSTED);
console.log('PUBLIC_IS_SELFHOSTED', PUBLIC_IS_SELFHOSTED);
// Selfhosted usecase would be here
if (IS_SELFHOSTED === 'true') {
if (PUBLIC_IS_SELFHOSTED === 'true') {
const subdomain = getSubdomain(url);
console.log('subdomain', subdomain);
@@ -87,7 +87,8 @@ export const load = async ({ url, cookies, request }): Promise<LoadOutput> => {
console.log('custom domain response.org', response.org);
if (!response.org) {
throw redirect(307, 'https://app.classroomio.com/404?type=org');
console.error('Custom domain org not found, loading dashboard');
return response;
}
response.isOrgSite = true;