mirror of
https://github.com/detleph/server.git
synced 2026-09-04 23:45:00 +02:00
restructured default admin creation
This commit is contained in:
@@ -20,6 +20,6 @@ export const generateDefaultCredentials = async () => {
|
||||
update: {},
|
||||
});
|
||||
|
||||
logger.notice("Default admin name is " + name);
|
||||
logger.notice("Default admin name is: " + name);
|
||||
logger.notice("Confidential password: " + pw);
|
||||
};
|
||||
|
||||
+2
-14
@@ -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"
|
||||
);
|
||||
|
||||
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
|
||||
app.use(cors());
|
||||
} else {
|
||||
logger.info("Using production mode");
|
||||
|
||||
generateDefaultCredentials();
|
||||
|
||||
// Configure cors
|
||||
/*app.use(
|
||||
cors({
|
||||
@@ -72,6 +58,8 @@ async function main() {
|
||||
});
|
||||
}
|
||||
|
||||
generateDefaultCredentials();
|
||||
|
||||
// Todo: Everything
|
||||
|
||||
// Bodyparser and urlencoded to parse post request bodies
|
||||
|
||||
Reference in New Issue
Block a user