mirror of
https://github.com/detleph/server.git
synced 2026-09-08 07:56:18 +02:00
restructured default admin creation
This commit is contained in:
@@ -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
@@ -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
|
||||||
|
|||||||
Reference in New Issue
Block a user