Remove path environment variables
Paths such as SIGN_IN_PATH and SIGN_UP_PATH have been hardcoded into the application instead of being environment variables. These changes simplify the configuration of the application, making maintenance and understanding of the codebase easier.
This commit is contained in:
@@ -619,12 +619,6 @@ NEXT_PUBLIC_KEYSTATIC_CONTENT_PATH=./content
|
|||||||
# LOCALES PATH
|
# LOCALES PATH
|
||||||
NEXT_PUBLIC_LOCALES_PATH=apps/web/public/locales
|
NEXT_PUBLIC_LOCALES_PATH=apps/web/public/locales
|
||||||
|
|
||||||
# PATHS (to be used in "packages")
|
|
||||||
SIGN_IN_PATH=/auth/sign-in
|
|
||||||
SIGN_UP_PATH=/auth/sign-up
|
|
||||||
TEAM_ACCOUNTS_HOME_PATH=/home
|
|
||||||
INVITATION_PAGE_PATH=/join
|
|
||||||
|
|
||||||
# FEATURE FLAGS
|
# FEATURE FLAGS
|
||||||
NEXT_PUBLIC_ENABLE_THEME_TOGGLE=true
|
NEXT_PUBLIC_ENABLE_THEME_TOGGLE=true
|
||||||
NEXT_PUBLIC_ENABLE_PERSONAL_ACCOUNT_DELETION=true
|
NEXT_PUBLIC_ENABLE_PERSONAL_ACCOUNT_DELETION=true
|
||||||
|
|||||||
@@ -30,12 +30,6 @@ NEXT_PUBLIC_KEYSTATIC_CONTENT_PATH=./content
|
|||||||
# LOCALES PATH
|
# LOCALES PATH
|
||||||
NEXT_PUBLIC_LOCALES_PATH=apps/web/public/locales
|
NEXT_PUBLIC_LOCALES_PATH=apps/web/public/locales
|
||||||
|
|
||||||
# PATHS (to be used in "packages")
|
|
||||||
SIGN_IN_PATH=/auth/sign-in
|
|
||||||
SIGN_UP_PATH=/auth/sign-up
|
|
||||||
TEAM_ACCOUNTS_HOME_PATH=/home
|
|
||||||
INVITATION_PAGE_PATH=/join
|
|
||||||
|
|
||||||
# FEATURE FLAGS
|
# FEATURE FLAGS
|
||||||
NEXT_PUBLIC_ENABLE_THEME_TOGGLE=true
|
NEXT_PUBLIC_ENABLE_THEME_TOGGLE=true
|
||||||
NEXT_PUBLIC_ENABLE_PERSONAL_ACCOUNT_DELETION=true
|
NEXT_PUBLIC_ENABLE_PERSONAL_ACCOUNT_DELETION=true
|
||||||
|
|||||||
@@ -2,21 +2,12 @@
|
|||||||
|
|
||||||
import { redirect } from 'next/navigation';
|
import { redirect } from 'next/navigation';
|
||||||
|
|
||||||
import { z } from 'zod';
|
|
||||||
|
|
||||||
import { enhanceAction } from '@kit/next/actions';
|
import { enhanceAction } from '@kit/next/actions';
|
||||||
import { getSupabaseServerActionClient } from '@kit/supabase/server-actions-client';
|
import { getSupabaseServerActionClient } from '@kit/supabase/server-actions-client';
|
||||||
|
|
||||||
import { CreateTeamSchema } from '../../schema/create-team.schema';
|
import { CreateTeamSchema } from '../../schema/create-team.schema';
|
||||||
import { createCreateTeamAccountService } from '../services/create-team-account.service';
|
import { createCreateTeamAccountService } from '../services/create-team-account.service';
|
||||||
|
|
||||||
const path = z
|
|
||||||
.string({
|
|
||||||
required_error: 'variable TEAM_ACCOUNTS_HOME_PATH is required',
|
|
||||||
})
|
|
||||||
.min(1)
|
|
||||||
.parse(process.env.TEAM_ACCOUNTS_HOME_PATH);
|
|
||||||
|
|
||||||
export const createOrganizationAccountAction = enhanceAction(
|
export const createOrganizationAccountAction = enhanceAction(
|
||||||
async (params, user) => {
|
async (params, user) => {
|
||||||
const client = getSupabaseServerActionClient();
|
const client = getSupabaseServerActionClient();
|
||||||
@@ -31,7 +22,7 @@ export const createOrganizationAccountAction = enhanceAction(
|
|||||||
throw new Error('Error creating team account');
|
throw new Error('Error creating team account');
|
||||||
}
|
}
|
||||||
|
|
||||||
const accountHomePath = path + '/' + data.slug;
|
const accountHomePath = '/home/' + data.slug;
|
||||||
|
|
||||||
redirect(accountHomePath);
|
redirect(accountHomePath);
|
||||||
},
|
},
|
||||||
|
|||||||
@@ -7,7 +7,7 @@ import { Database } from '@kit/supabase/database';
|
|||||||
|
|
||||||
type Invitation = Database['public']['Tables']['invitations']['Row'];
|
type Invitation = Database['public']['Tables']['invitations']['Row'];
|
||||||
|
|
||||||
const invitePath = process.env.INVITATION_PAGE_PATH;
|
const invitePath = '/join';
|
||||||
const siteURL = process.env.NEXT_PUBLIC_SITE_URL;
|
const siteURL = process.env.NEXT_PUBLIC_SITE_URL;
|
||||||
const productName = process.env.NEXT_PUBLIC_PRODUCT_NAME ?? '';
|
const productName = process.env.NEXT_PUBLIC_PRODUCT_NAME ?? '';
|
||||||
const emailSender = process.env.EMAIL_SENDER;
|
const emailSender = process.env.EMAIL_SENDER;
|
||||||
|
|||||||
@@ -1,18 +1,9 @@
|
|||||||
import type { SupabaseClient, User } from '@supabase/supabase-js';
|
import type { SupabaseClient, User } from '@supabase/supabase-js';
|
||||||
|
|
||||||
import { z } from 'zod';
|
|
||||||
|
|
||||||
import { checkRequiresMultiFactorAuthentication } from './check-requires-mfa';
|
import { checkRequiresMultiFactorAuthentication } from './check-requires-mfa';
|
||||||
|
|
||||||
const MULTI_FACTOR_AUTH_VERIFY_PATH = z
|
const MULTI_FACTOR_AUTH_VERIFY_PATH = '/auth/verify';
|
||||||
.string()
|
const SIGN_IN_PATH = '/auth/sign-in';
|
||||||
.default('/auth/verify')
|
|
||||||
.parse(process.env.MULTI_FACTOR_AUTH_VERIFY_PATH);
|
|
||||||
|
|
||||||
const SIGN_IN_PATH = z
|
|
||||||
.string()
|
|
||||||
.default('/auth/sign-in')
|
|
||||||
.parse(process.env.SIGN_IN_PATH);
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @name requireUser
|
* @name requireUser
|
||||||
|
|||||||
@@ -67,10 +67,6 @@
|
|||||||
"EMAIL_HOST",
|
"EMAIL_HOST",
|
||||||
"EMAIL_TLS",
|
"EMAIL_TLS",
|
||||||
"EMAIL_USER",
|
"EMAIL_USER",
|
||||||
"EMAIL_PASSWORD",
|
"EMAIL_PASSWORD"
|
||||||
"SIGN_IN_PATH",
|
|
||||||
"SIGN_UP_PATH",
|
|
||||||
"TEAM_ACCOUNTS_HOME_PATH",
|
|
||||||
"INVITATION_PAGE_PATH"
|
|
||||||
]
|
]
|
||||||
}
|
}
|
||||||
Reference in New Issue
Block a user