forked from skygragon/leetcode-cli
-
Notifications
You must be signed in to change notification settings - Fork 51
/
Copy pathconfig.js
35 lines (28 loc) · 1.01 KB
/
config.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
var _ = require('underscore');
var fs = require('fs');
var h = require('./helper');
var defaultConfig = {
// usually you don't wanna change those
BASE_URL: 'https://leetcode.com',
LOGIN_URL: 'https://leetcode.com/accounts/login/',
PROBLEMS_URL: 'https://leetcode.com/api/problems/algorithms/',
PROBLEM_URL: 'https://leetcode.com/problems/$id',
TEST_URL: 'https://leetcode.com/problems/$key/interpret_solution/',
SUBMIT_URL: 'https://leetcode.com/problems/$key/submit/',
VERIFY_URL: 'https://leetcode.com/submissions/detail/$id/check/',
// but you will want change these
LANG: 'cpp', // avail: [c,cpp,csharp,golang,java,javascript,python,ruby,swift]
USE_COLOR: true,
AUTO_LOGIN: false
};
function initConfig() {
var config = defaultConfig;
// check local config: ~/.lcconfig
var f = h.getConfigFile();
if (fs.existsSync(f)) {
var localConfig = JSON.parse(fs.readFileSync(f));
_.extend(defaultConfig, localConfig);
}
return config;
}
module.exports = initConfig();