jwt secret is now autogenerated

This commit is contained in:
2026-01-07 19:07:47 +01:00
parent 82ddc6d5e9
commit c225a9f48d
11 changed files with 101 additions and 25 deletions

View File

@@ -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" }
);