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

@@ -1,10 +1,16 @@
import { FastifyReply, FastifyRequest } from 'fastify';
import { getConfig, setConfig } from '../../shared/config';
function hideSecrets(values: any) {
const copy = structuredClone(values);
if (copy.server?.jwt_secret) delete copy.server.jwt_secret;
return copy;
}
export async function getFullConfig(req: FastifyRequest, reply: FastifyReply) {
try {
const { values, schema } = getConfig();
return { values, schema };
return { values: hideSecrets(values), schema };
} catch {
return { error: "Error loading config" };
}
@@ -22,7 +28,7 @@ export async function getConfigSection(
return { error: "Section not found" };
}
return { [section]: values[section] };
return { [section]: hideSecrets(values)[section] };
} catch {
return { error: "Error loading config section" };
}