Only create default admin when in development mode

This commit is contained in:
Stephan
2022-05-16 15:38:22 +02:00
parent 510624cbc6
commit 2eb9edee69
+8 -3
View File
@@ -19,12 +19,14 @@ require("dotenv").config(); // Load dotenv config
const app = express(); const app = express();
async function main() {
if (process.env.NODE_ENV === "development") { if (process.env.NODE_ENV === "development") {
logger.info("Using development mode"); logger.info("Using development mode");
} logger.warning(
"This mode should not be used in any production-near environment as it is significantly less secure than the production mode"
);
async function main() { // TODO: How should you login to the prod server by default? Maybe random password?
// Dev
await prisma.admin.upsert({ await prisma.admin.upsert({
where: { id: 1 }, where: { id: 1 },
create: { create: {
@@ -34,6 +36,9 @@ async function main() {
}, },
update: {}, update: {},
}); });
} else {
logger.info("Using production mode");
}
// Todo: Everything // Todo: Everything