-
Notifications
You must be signed in to change notification settings - Fork 0
/
setup.js
59 lines (47 loc) · 1.33 KB
/
setup.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
/*
Genesis - Holaclient-E Daemon
This code shall not be distributed publicly
Made by Demon
*/
const Keyv = require('keyv');
const figlet = require('figlet');
const readline = require('readline');
const os = require('os');
const fs = require('fs');
const a = figlet.textSync('Genesis', {
font: 'Big',
horizontalLayout: 'default',
verticalLayout: 'default'
});
console.log(a);
const b = os.type();
const db = new Keyv('sqlite://database.sqlite');
const rl = readline.createInterface({
input: process.stdin,
output: process.stdout
});
rl.question('Enter Node IP/URL: ', async (nodeUrl) => {
nodeUrl = nodeUrl.trim();
rl.question('Enter key: ', async (key) => {
key = key.trim();
rl.question('Enter Panel URL: ', async (panelUrl) => {
panelUrl = panelUrl.trim();
await db.set('nodeUrl', nodeUrl);
await db.set('key', key);
await db.set('panelUrl', panelUrl);
console.log('Setup completed! Configuration saved.');
rl.close();
});
});
});
let c;
if (b === 'Windows_NT') {
c = '//./pipe/docker_engine';
} else if (b === 'Linux' || b === 'Darwin') {
c = '/var/run/docker.sock';
} else {
console.log('Unsupported operating system');
process.exit(1);
}
let d = { c }
fs.writeFileSync('config.json', JSON.stringify(c));