-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathhooks.mjs
More file actions
47 lines (42 loc) · 1.46 KB
/
hooks.mjs
File metadata and controls
47 lines (42 loc) · 1.46 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
import {start} from "bfast-function";
import {dirname} from 'path';
import {fileURLToPath} from 'url';
const config = {
applicationId: 'bfast',
useLocalIpfs: true,
projectId: 'bfast',
port: '3111',
logs: false,
web3Token: process.env['WEB_3_TOKEN'],
adapters: {s3Storage: undefined},
masterKey: 'bfast',
taarifaToken: undefined,
databaseURI: 'mongodb://localhost/bfast',
rsaKeyPairInJson: {},
rsaPublicKeyInJson: {}
}
const __dirname = dirname(fileURLToPath(import.meta.url));
export const mochaHooks = {
async beforeAll() {
process.env.APPLICATION_ID = config.applicationId;
process.env.PROJECT_ID = config.projectId;
process.env.MASTER_KEY = config.masterKey;
process.env.PORT = config.port.toString();
process.env.DATABASE_URI = config.databaseURI;
process.env.TAARIFA_TOKEN = config.taarifaToken;
process.env.RSA_PUBLIC_KEY = JSON.stringify(config.rsaPublicKeyInJson);
process.env.RSA_KEY = JSON.stringify(config.rsaKeyPairInJson);
process.env.USE_LOCAL_IPFS = 'true';
console.log('________START__________');
await start({
port: config.port,
functionsConfig: {
functionsDirPath: __dirname + '/specs/functions',
bfastJsonPath: __dirname + '/specs/bfast.json'
}
}).catch(console.log);
},
async afterAll() {
console.log('________END__________');
}
};