diff --git a/apps/api/prisma/seed.js b/apps/api/prisma/seed.js index 011359682..78a625e17 100644 --- a/apps/api/prisma/seed.js +++ b/apps/api/prisma/seed.js @@ -23,7 +23,8 @@ async function main() { await prisma.setting.create({ data: { isRegistrationEnabled: true, - isTraefikUsed: true, + proxyPassword: encrypt(generatePassword()), + proxyUser: cuid() } }); } else { @@ -72,4 +73,16 @@ main() }) .finally(async () => { await prisma.$disconnect(); - }); \ No newline at end of file + }); + +const encrypt = (text) => { + if (text) { + const iv = crypto.randomBytes(16); + const cipher = crypto.createCipheriv(algorithm, process.env['COOLIFY_SECRET_KEY'], iv); + const encrypted = Buffer.concat([cipher.update(text), cipher.final()]); + return JSON.stringify({ + iv: iv.toString('hex'), + content: encrypted.toString('hex') + }); + } +}; \ No newline at end of file