-
Notifications
You must be signed in to change notification settings - Fork 533
/
index.js
39 lines (31 loc) · 1004 Bytes
/
index.js
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
var snykConfig = require('./config');
// This module is kind of "world object" that is used to indirectly import modules.
// This also introduces some circular imports.
// TODO(kyegupov): untangle this, resolve circular imports, convert to Typescript
var snyk = {};
module.exports = snyk;
snyk.id = snykConfig.id;
var apiToken = require('./api-token');
// make snyk.api *always* get the latest api token from the config store
Object.defineProperty(snyk, 'api', {
enumerable: true,
configurable: true,
get: function () {
return apiToken.apiTokenExists();
},
set: function (value) {
snykConfig.api = value;
},
});
snyk.modules = require('./modules');
snyk.test = require('./snyk-test');
snyk.bus = require('./bus');
snyk.policy = require('snyk-policy');
snyk.isRequired = true; // changed to false when loaded via cli
snyk.isolate = {
okay: function () {
return true;
},
};
// this is the user config, and not the internal config
snyk.config = require('./user-config');