测试脚本添加签名密钥生成
continuous-integration/drone/push Build is failing Details

This commit is contained in:
Qumolama.d 2022-05-14 14:36:07 +08:00
parent 1a3e37f39a
commit 373ce3d003
Signed by: Lama3L9R
GPG Key ID: 1762AFC05157CE18
1 changed files with 18 additions and 0 deletions

View File

@ -1,7 +1,25 @@
import { config } from '../../src/config.js'
import { server, setup, shutdown } from '../../src/index.js'
import { generateKeyPairSync } from 'crypto'
import { existsSync, writeFileSync } from 'fs'
beforeAll(() => {
if(!existsSync(config.signing.private)) {
const { publicKey, privateKey } = generateKeyPairSync('rsa', {
modulusLength: 4096,
publicKeyEncoding: {
type: "pkcs1",
format: "pem"
},
privateKeyEncoding: {
type: "pkcs1",
format: "pem"
}
})
writeFileSync('public.pem', publicKey)
writeFileSync('private.pem', privateKey)
}
config.database.url = 'mongodb://setup-database:27017/yggdrasil?readPreference=primary&appname=MongoDB%20Compass&directConnection=true&ssl=false'
return setup()
})