Fix: lamassu-register with async local store
This commit is contained in:
parent
cb2e1b3907
commit
2e45098033
1 changed files with 17 additions and 14 deletions
|
|
@ -1,5 +1,6 @@
|
|||
#!/usr/bin/env node
|
||||
|
||||
const { asyncLocalStorage, defaultStore } = require('../lib/async-storage')
|
||||
const authentication = require('../lib/new-admin/graphql/modules/authentication')
|
||||
const options = require('../lib/options')
|
||||
|
||||
|
|
@ -29,7 +30,8 @@ if (role !== 'user' && role !== 'superuser') {
|
|||
process.exit(2)
|
||||
}
|
||||
|
||||
authentication.createRegisterToken(name, role).then(token => {
|
||||
asyncLocalStorage.run(defaultStore(), () => {
|
||||
authentication.createRegisterToken(name, role).then(token => {
|
||||
if (!token) {
|
||||
console.log(`A user named ${name} already exists!`)
|
||||
process.exit(2)
|
||||
|
|
@ -42,7 +44,8 @@ authentication.createRegisterToken(name, role).then(token => {
|
|||
}
|
||||
|
||||
process.exit(0)
|
||||
}).catch(err => {
|
||||
}).catch(err => {
|
||||
console.log('Error: %s', err)
|
||||
process.exit(3)
|
||||
})
|
||||
})
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue