restructured default admin creation

This commit is contained in:
Laurin
2022-10-20 16:08:10 +02:00
committed by La_Felx
parent ff13a95eac
commit 28d48cd178
2 changed files with 3 additions and 15 deletions
+1 -1
View File
@@ -20,6 +20,6 @@ export const generateDefaultCredentials = async () => {
update: {}, update: {},
}); });
logger.notice("Default admin name is " + name); logger.notice("Default admin name is: " + name);
logger.notice("Confidential password: " + pw); logger.notice("Confidential password: " + pw);
}; };
+2 -14
View File
@@ -35,25 +35,11 @@ async function main() {
"This mode should not be used in any production-near environment as it is significantly less secure than the production mode" "This mode should not be used in any production-near environment as it is significantly less secure than the production mode"
); );
generateDefaultCredentials();
// TODO: How should you login to the prod server by default? Maybe random password?
await prisma.admin.upsert({
where: { id: 1 },
create: {
name: "admin",
password: await argon2.hash("test", { type: argon2.argon2id }),
permission_level: "ELEVATED",
},
update: {},
});
// Allow all CORS requests // Allow all CORS requests
app.use(cors()); app.use(cors());
} else { } else {
logger.info("Using production mode"); logger.info("Using production mode");
generateDefaultCredentials();
// Configure cors // Configure cors
/*app.use( /*app.use(
cors({ cors({
@@ -72,6 +58,8 @@ async function main() {
}); });
} }
generateDefaultCredentials();
// Todo: Everything // Todo: Everything
// Bodyparser and urlencoded to parse post request bodies // Bodyparser and urlencoded to parse post request bodies