Skip to content

Commit

Permalink
fix: exit on missing jwt secret
Browse files Browse the repository at this point in the history
  • Loading branch information
abuaboud committed Jun 18, 2024
1 parent 6285615 commit 7fb457d
Showing 1 changed file with 9 additions and 0 deletions.
9 changes: 9 additions & 0 deletions packages/server/api/src/app/app.ts
Original file line number Diff line number Diff line change
Expand Up @@ -107,6 +107,8 @@ import {
spreadIfDefined,
UserInvitation,
} from '@activepieces/shared'
import { isNil } from 'lodash'
import { jwtUtils } from './helper/jwt-utils'

export const setupApp = async (): Promise<FastifyInstance> => {
const app = fastify({
Expand Down Expand Up @@ -383,6 +385,13 @@ export const setupApp = async (): Promise<FastifyInstance> => {
const validateEnvPropsOnStartup = async (): Promise<void> => {
const queueMode = system.getOrThrow<QueueMode>(SystemProp.QUEUE_MODE)
await encryptUtils.loadEncryptionKey(queueMode)

const jwtSecret = await jwtUtils.getJwtSecret()
if(isNil(jwtSecret)){
throw new Error(JSON.stringify({
message: 'JWT_SECRET is undefined, please define it in the environment variables',
}))
}
}

async function getAdapter() {
Expand Down

0 comments on commit 7fb457d

Please sign in to comment.