forked from datalens-tech/datalens-us
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathnodekit.ts
37 lines (29 loc) · 965 Bytes
/
nodekit.ts
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
import dotenv from 'dotenv';
dotenv.config();
import * as path from 'path';
import {NodeKit} from '@gravity-ui/nodekit';
import {schema} from './components/gateway/schema';
import {getGatewayConfig} from './components/gateway';
import {initDB} from './db/init-db';
import {registry} from './registry';
// Initialization order: nodekit -> db -> gateway -> expresskit
const nodekit = new NodeKit({
configsPath: path.resolve(__dirname, 'configs'),
});
const {appName, appEnv, appInstallation, appDevMode} = nodekit.config;
nodekit.ctx.log('AppConfig details', {
appName,
appEnv,
appInstallation,
appDevMode,
});
const {dynamicFeaturesEndpoint} = nodekit.config;
if (dynamicFeaturesEndpoint) {
nodekit.setupDynamicConfig('features', {
url: dynamicFeaturesEndpoint,
});
}
const initedDB = initDB(nodekit);
registry.setupDbInstance(initedDB);
registry.setupGateway(getGatewayConfig(nodekit), {root: schema});
export {nodekit};