jwt secret is now autogenerated
This commit is contained in:
@@ -2,6 +2,10 @@ import { FastifyReply, FastifyRequest } from 'fastify';
|
||||
import * as userService from './user.service';
|
||||
import {queryOne} from '../../shared/database';
|
||||
import jwt from "jsonwebtoken";
|
||||
import { getConfig } from '../../shared/config';
|
||||
const { values } = getConfig();
|
||||
const jwtSecret = values.server?.jwt_secret;
|
||||
|
||||
|
||||
interface UserIdParams { id: string; }
|
||||
interface CreateUserBody {
|
||||
@@ -75,7 +79,7 @@ export async function login(req: FastifyRequest, reply: FastifyReply) {
|
||||
|
||||
const token = jwt.sign(
|
||||
{ id: userId },
|
||||
process.env.JWT_SECRET!,
|
||||
jwtSecret,
|
||||
{ expiresIn: "7d" }
|
||||
);
|
||||
|
||||
|
||||
Reference in New Issue
Block a user