1 | 'use strict';
|
2 |
|
3 |
|
4 |
|
5 | const os = require('os');
|
6 | const path = require('path');
|
7 |
|
8 |
|
9 |
|
10 | const AppDirectory = require('appdirectory');
|
11 |
|
12 |
|
13 |
|
14 | const pkg = require('../package.json');
|
15 |
|
16 |
|
17 |
|
18 | const CONFIG_FILE = '.blinkmrc.json';
|
19 |
|
20 |
|
21 | const platform = (() => {
|
22 | const p = os.platform();
|
23 | if (p === 'darwin') {
|
24 | return 'linux';
|
25 | }
|
26 | return p;
|
27 | })();
|
28 |
|
29 | const dirs = new AppDirectory({
|
30 | appName: pkg.name,
|
31 | platform,
|
32 | useRoaming: false
|
33 | });
|
34 |
|
35 | const USER_CONFIG_DIR = dirs.userConfig();
|
36 |
|
37 | const MAX_REQUESTS = 5;
|
38 |
|
39 | module.exports = {
|
40 | CONFIG_FILE,
|
41 | MAX_REQUESTS
|
42 | };
|
43 |
|
44 | Object.defineProperty(module.exports, 'USER_CONFIG_DIR', {
|
45 | enumerable: true,
|
46 | get () {
|
47 | return process.env.BMP_USER_CONFIG_DIR || USER_CONFIG_DIR;
|
48 | }
|
49 | });
|
50 |
|
51 | Object.defineProperty(module.exports, 'USER_CONFIG_FILE', {
|
52 | enumerable: true,
|
53 | get () {
|
54 | const dirPath = process.env.BMP_USER_CONFIG_DIR || USER_CONFIG_DIR;
|
55 | return path.join(dirPath, 'blinkmrc.json');
|
56 | }
|
57 | });
|