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
|
/**
* This object contains Prompt ( https://www.npmjs.com/package/prompt ) style
* questions that the SetupWizard will require an answer to. Questions are asked
* in the order they are specified here.
*
* The resulting config.json file will be used by the server, accessed by the
* name specified. IE, a valid use is; config.adminName
*
*/
const Questions = {
properties: {
tripSalt: {
description: 'Salt (leave as default)',
type: 'string',
hidden: true,
replace: '*',
before: (value) => {
salt = value;
return value;
},
},
adminName: {
description: 'Admin Nickname',
pattern: /^"?[a-zA-Z0-9_]+"?$/,
type: 'string',
message: 'Nicks can only contain letters, numbers and underscores',
before: (value) => value.replace(/"/g, ''),
},
adminTrip: {
type: 'string',
hidden: true,
replace: '*',
description: 'Admin Password',
message: 'You must enter or re-enter a password',
before: (value) => {
const crypto = require('crypto');
const sha = crypto.createHash('sha256');
sha.update(value + salt);
return sha.digest('base64').substr(0, 6);
},
},
websocketPort: {
type: 'integer',
message: 'The port may only be a number!',
description: 'Websocket Port',
default: '6060',
},
},
};
module.exports = Questions;
|