🧑💻 Improve env variables type safety and management (#718)
Closes #679
This commit is contained in:
@ -4,6 +4,7 @@ import { isNotDefined } from '@typebot.io/lib'
|
||||
import { sign } from 'jsonwebtoken'
|
||||
import { getServerSession } from 'next-auth'
|
||||
import { authOptions } from './api/auth/[...nextauth]'
|
||||
import { env } from '@typebot.io/env'
|
||||
|
||||
export default function Page() {
|
||||
return null
|
||||
@ -28,7 +29,7 @@ export async function getServerSideProps(context: GetServerSidePropsContext) {
|
||||
}
|
||||
|
||||
const createSSOToken = (user: User) => {
|
||||
if (!process.env.SLEEKPLAN_SSO_KEY) return
|
||||
if (!env.SLEEKPLAN_SSO_KEY) return
|
||||
const userData = {
|
||||
mail: user.email,
|
||||
id: user.id,
|
||||
@ -36,5 +37,5 @@ const createSSOToken = (user: User) => {
|
||||
img: user.image,
|
||||
}
|
||||
|
||||
return sign(userData, process.env.SLEEKPLAN_SSO_KEY, { algorithm: 'HS256' })
|
||||
return sign(userData, env.SLEEKPLAN_SSO_KEY, { algorithm: 'HS256' })
|
||||
}
|
||||
|
Reference in New Issue
Block a user