You cannot select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

26 lines
716 B
JavaScript

const pool = require('../src/config/database');
const { ensureBootstrapAdmin, readBootstrapAdminConfig } = require('../src/utils/bootstrapAdmin');
async function createAdmin() {
const config = readBootstrapAdminConfig();
try {
const result = await ensureBootstrapAdmin({
resetPassword: true,
createIfActiveAdminExists: true,
});
console.log('Master account is ready:', result.user);
console.log(`Username: ${config.username}`);
console.log(`Password: ${config.password}`);
console.log('Change this password after the first login.');
} catch (error) {
console.error('Error:', error);
process.exitCode = 1;
} finally {
await pool.end();
}
}
createAdmin();