Account tools fix (#818)

Signed-off-by: Denis Bykhov <80476319+BykhovDenis@users.noreply.github.com>
This commit is contained in:
Denis Bykhov 2022-01-13 18:16:06 +06:00 committed by GitHub
parent 0557072f10
commit 9de79ba5bd
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 8 additions and 2 deletions

View File

@ -14,7 +14,7 @@
// limitations under the License.
//
import {
import accountPlugin, {
ACCOUNT_DB,
assignWorkspace,
createAccount,
@ -25,6 +25,7 @@ import {
listWorkspaces,
listAccounts
} from '@anticrm/account'
import { setMetadata } from '@anticrm/platform'
import { program } from 'commander'
import { Client } from 'minio'
import { Db, MongoClient } from 'mongodb'
@ -69,6 +70,9 @@ if (elasticUrl === undefined) {
process.exit(1)
}
setMetadata(accountPlugin.metadata.Endpoint, transactorUrl)
setMetadata(accountPlugin.metadata.Transactor, transactorUrl)
const minio = new Client({
endPoint: minioEndpoint,
port: 9000,
@ -93,7 +97,7 @@ program
.description('create user and corresponding account in master database')
.requiredOption('-p, --password <password>', 'user password')
.requiredOption('-f, --first <first>', 'first name')
.requiredOption('-l, --last <last>', 'first name')
.requiredOption('-l, --last <last>', 'last name')
.action(async (email: string, cmd) => {
return await withDatabase(mongodbUri, async (db) => {
console.log(`creating account ${cmd.first as string} ${cmd.last as string} (${email})...`)

View File

@ -76,6 +76,8 @@ export async function initWorkspace (transactorUrl: string, dbName: string): Pro
const connection = await connect(transactorUrl, dbName)
try {
await createDeps(connection)
} catch (e) {
console.log(e)
} finally {
await connection.close()
}