chore: move IS_SELFHOSTED to public env
This commit is contained in:
@@ -4,7 +4,7 @@ PUBLIC_SUPABASE_ANON_KEY=
|
||||
PRIVATE_SUPABASE_SERVICE_ROLE=
|
||||
|
||||
# Selfhosting - should be true if you are selfhosting
|
||||
IS_SELFHOSTED=false
|
||||
PUBLIC_IS_SELFHOSTED=false
|
||||
DEPLOYMENT_PROVIDER= # docker or empty. empty will use adapter-auto for sveltekit build
|
||||
|
||||
# Unsplash setup - Optional if you want to use Unsplash images
|
||||
|
||||
@@ -30,7 +30,7 @@ RUN pnpm install
|
||||
COPY apps/dashboard ./apps/dashboard
|
||||
|
||||
# Set env vars for SvelteKit to use Node adapter
|
||||
ENV IS_SELFHOSTED=true \
|
||||
ENV PUBLIC_IS_SELFHOSTED=true \
|
||||
DEPLOYMENT_PROVIDER=docker \
|
||||
PUBLIC_SUPABASE_URL=$PUBLIC_SUPABASE_URL \
|
||||
PUBLIC_SUPABASE_ANON_KEY=$PUBLIC_SUPABASE_ANON_KEY \
|
||||
@@ -67,7 +67,7 @@ EXPOSE 3000
|
||||
|
||||
# Set environment variables for production
|
||||
ENV NODE_ENV=production \
|
||||
IS_SELFHOSTED=true \
|
||||
PUBLIC_IS_SELFHOSTED=true \
|
||||
DEPLOYMENT_PROVIDER=docker \
|
||||
PUBLIC_SUPABASE_URL=$PUBLIC_SUPABASE_URL \
|
||||
PUBLIC_SUPABASE_ANON_KEY=$PUBLIC_SUPABASE_ANON_KEY \
|
||||
|
||||
@@ -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);
|
||||
|
||||
|
||||
@@ -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;
|
||||
|
||||
@@ -7,7 +7,7 @@ import path from 'path';
|
||||
import 'dotenv/config';
|
||||
|
||||
const useNodeAdapter =
|
||||
process.env.IS_SELFHOSTED === 'true' && process.env.DEPLOYMENT_PROVIDER === 'docker';
|
||||
process.env.PUBLIC_IS_SELFHOSTED === 'true' && process.env.DEPLOYMENT_PROVIDER === 'docker';
|
||||
|
||||
/** @type {import('@sveltejs/kit').Config} */
|
||||
const config = {
|
||||
|
||||
+1
-1
@@ -68,7 +68,7 @@ services:
|
||||
- /app/node_modules
|
||||
- /app/apps/dashboard/node_modules
|
||||
environment:
|
||||
- IS_SELFHOSTED=true
|
||||
- PUBLIC_IS_SELFHOSTED=true
|
||||
- DEPLOYMENT_PROVIDER=docker
|
||||
# Supabase - Database
|
||||
- PUBLIC_SUPABASE_URL=${PUBLIC_SUPABASE_URL}
|
||||
|
||||
+1
-1
@@ -10,7 +10,7 @@
|
||||
"release": "standard-version",
|
||||
"ci": "cypress run",
|
||||
"supabase": "pnpx supabase",
|
||||
"dashboard:build": "cd apps/dashboard && pnpm i && IS_SELFHOSTED=true NODE_OPTIONS='--max-old-space-size=20384' DEPLOYMENT_PROVIDER=docker pnpm build",
|
||||
"dashboard:build": "cd apps/dashboard && pnpm i && PUBLIC_IS_SELFHOSTED=true NODE_OPTIONS='--max-old-space-size=20384' DEPLOYMENT_PROVIDER=docker pnpm build",
|
||||
"dashboard:start": "cd apps/dashboard && node build"
|
||||
},
|
||||
"license": "MIT",
|
||||
|
||||
+1
-1
@@ -1,6 +1,6 @@
|
||||
{
|
||||
"$schema": "https://turbo.build/schema.json",
|
||||
"globalEnv": ["IS_SELFHOSTED", "DEPLOYMENT_PROVIDER"],
|
||||
"globalEnv": ["PUBLIC_IS_SELFHOSTED", "DEPLOYMENT_PROVIDER"],
|
||||
"pipeline": {
|
||||
"build": {
|
||||
"dependsOn": ["^build"],
|
||||
|
||||
Reference in New Issue
Block a user