This commit is contained in:
Andras Bacsai
2023-07-14 23:15:43 +02:00
parent 055ff6dbbd
commit 9ebfc6646e
11 changed files with 307 additions and 247 deletions

View File

@@ -13,8 +13,12 @@ declare module '@fastify/jwt' {
}
export default fp<FastifyJWTOptions>(async (fastify, opts) => {
let secretKey = fastify.config.COOLIFY_SECRET_KEY_BETTER;
if (!secretKey) {
secretKey = fastify.config.COOLIFY_SECRET_KEY;
}
fastify.register(fastifyJwt, {
secret: fastify.config.COOLIFY_SECRET_KEY_BETTER ?? fastify.config.COOLIFY_SECRET_KEY
secret: secretKey
});
fastify.decorate('authenticate', async function (request, reply) {