-
-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathconfigure.js
59 lines (56 loc) · 2.56 KB
/
configure.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
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
const readline = require('readline');
const fs = require('fs');
const path = require('path');
const rl = readline.createInterface({
input: process.stdin,
output: process.stdout
});
let originalConfig = require('./config.json');
let newConfig = {
"18": true,
};
(async () => {
console.log('To cancel at any time press Ctrl + C. Leave blank to use previous value.');
askQuestions();
function askQuestions() {
rl.question('Enter your Anti Captcha API Key: ', (answer) => {
if (!answer) answer = originalConfig["anti-captcha-key"];
newConfig["anti-captcha-key"] = answer;
console.log(answer)
rl.question('Enter the phone number: ', (answer) => {
if (!answer) answer = originalConfig["phone"];
newConfig["phone"] = answer;
rl.question('Enter the beneficiary ids separated by commas: ', (answer) => {
if (!answer) {
newConfig.beneficiaries = originalConfig.beneficiaries
} else {
newConfig.beneficiaries = answer.trim().split(',');
}
rl.question('Enter the PinCode: ', (answer) => {
if (!answer) answer = originalConfig["pincode"];
newConfig.pincode = answer;
rl.question('Are you using Auto Token fetch? (Y/N) ', (answer) => {
if (!answer) {
answer = originalConfig["autotoken"];
newConfig.autotoken = answer;
} else {
answer = answer.toLowerCase();
newConfig.autotoken = answer === 'y';
}
rl.question('What dose are you applying for? (1 or 2) ', (answer) => {
if (!answer) answer = originalConfig["dose"];
answer = parseInt(answer);
newConfig.dose = answer;
setTimeout(function () {
console.log(`Generated the config file and saved it.`);
fs.writeFileSync(path.join(__dirname, './config.json'), JSON.stringify(newConfig));
process.exit(0);
}, 500)
});
});
});
});
});
});
}
})();