jwt secret is now autogenerated
This commit is contained in:
@@ -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" };
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user