Introduced Secrets Manager

This commit is contained in:
2025-09-28 17:43:21 +02:00
parent 4d9b1f1dff
commit 83fc24be0c
13 changed files with 79 additions and 32 deletions

View File

@@ -22,9 +22,11 @@ import exportRoutes from "./routes/exports"
import emailAsUserRoutes from "./routes/emailAsUser";
import {sendMail} from "./utils/mailer";
import {loadSecrets, secrets} from "./utils/secrets";
async function main() {
const app = Fastify({ logger: true });
await loadSecrets();
/*app.addHook("onRequest", (req, reply, done) => {
console.log("Incoming:", req.method, req.url, "Headers:", req.headers)
@@ -37,7 +39,7 @@ async function main() {
await app.register(supabasePlugin);
await app.register(tenantPlugin);
app.register(fastifyCookie, {
secret: process.env.COOKIE_SECRET || "supersecret", // optional, für signierte Cookies
secret: secrets.COOKIE_SECRET,
})
// Öffentliche Routes
await app.register(authRoutes);
@@ -68,8 +70,8 @@ async function main() {
// Start
try {
await app.listen({ port: 3100, host: "0.0.0.0" });
console.log("🚀 Server läuft auf http://localhost:3100");
await app.listen({ port: secrets.PORT, host: secrets.HOST });
console.log(`🚀 Server läuft auf http://${secrets.HOST}:${secrets.PORT}`);
} catch (err) {
app.log.error(err);
process.exit(1);