Commit 40200c7c by archer

root user

parent 502d8d8c
......@@ -67,18 +67,24 @@ async function initRootUser() {
const rootUser = await User.findOne({
username: 'root'
});
const psw = process.env.DEFAULT_ROOT_PSW || '123456';
if (rootUser) {
console.log('root user already exists');
return;
await User.findOneAndUpdate(
{ username: 'root' },
{
password: createHashPassword(psw)
}
);
} else {
await User.create({
username: 'root',
password: createHashPassword(psw),
balance: 999999 * PRICE_SCALE
});
}
const psw = process.env.DEFAULT_ROOT_PSW || '123456';
await User.create({
username: 'root',
password: createHashPassword(psw),
balance: 100 * PRICE_SCALE
});
console.log(`create root user success`, {
console.log(`root user init:`, {
username: 'root',
password: psw
});
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or sign in to comment