mirror of
https://gitlab.com/MrFry/mrfrys-node-server
synced 2025-04-01 20:24:18 +02:00
Optional key load in make
This commit is contained in:
parent
db6a7bd73b
commit
8b60ba764f
2 changed files with 23 additions and 17 deletions
|
@ -1,4 +1,3 @@
|
|||
|
||||
const utils = require('../utils/utils.js')
|
||||
const logger = require('../utils/logger.js')
|
||||
const dbtools = require('../utils/dbtools.js')
|
||||
|
@ -25,23 +24,25 @@ function CreateDB () {
|
|||
})
|
||||
|
||||
try {
|
||||
const uids = utils.ReadFile('../dbUsers/keys').split('\n')
|
||||
if (utils.FileExists('../dbUsers/keys')) {
|
||||
const uids = utils.ReadFile('../dbUsers/keys').split('\n')
|
||||
|
||||
uids.forEach((cid, i) => {
|
||||
if (!cid) { return }
|
||||
logger.Log(`[ ${i} / ${uids.length} ]`)
|
||||
try {
|
||||
dbtools.Insert(authDB, 'users', {
|
||||
pw: uuidv4(),
|
||||
oldCID: cid,
|
||||
avaiblePWRequests: 4,
|
||||
created: utils.GetDateString()
|
||||
})
|
||||
} catch (e) {
|
||||
logger.Log('Error during inserting', logger.GetColor('redbg'))
|
||||
console.error(e)
|
||||
}
|
||||
})
|
||||
uids.forEach((cid, i) => {
|
||||
if (!cid) { return }
|
||||
logger.Log(`[ ${i} / ${uids.length} ]`)
|
||||
try {
|
||||
dbtools.Insert(authDB, 'users', {
|
||||
pw: uuidv4(),
|
||||
oldCID: cid,
|
||||
avaiblePWRequests: 4,
|
||||
created: utils.GetDateString()
|
||||
})
|
||||
} catch (e) {
|
||||
logger.Log('Error during inserting', logger.GetColor('redbg'))
|
||||
console.error(e)
|
||||
}
|
||||
})
|
||||
}
|
||||
} catch (e) {
|
||||
console.error(e)
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue