aboutsummaryrefslogtreecommitdiffstats
path: root/server/src/scripts/setupSchema/Questions.js
diff options
context:
space:
mode:
authormarzavec <admin@marzavec.com>2019-03-19 07:36:21 +0100
committermarzavec <admin@marzavec.com>2019-03-19 07:36:21 +0100
commitc634e03cb553e21158fddc6d4221a54aa799de79 (patch)
tree74f303d4ab65b08c7ec316fb713146cc99024c00 /server/src/scripts/setupSchema/Questions.js
parentMerge pull request #56 from paulgreg/manifest (diff)
downloadhackchat-c634e03cb553e21158fddc6d4221a54aa799de79.tar.gz
hackchat-c634e03cb553e21158fddc6d4221a54aa799de79.zip
refactoring 1 of 2
Diffstat (limited to 'server/src/scripts/setupSchema/Questions.js')
-rw-r--r--server/src/scripts/setupSchema/Questions.js55
1 files changed, 55 insertions, 0 deletions
diff --git a/server/src/scripts/setupSchema/Questions.js b/server/src/scripts/setupSchema/Questions.js
new file mode 100644
index 0000000..f84d32f
--- /dev/null
+++ b/server/src/scripts/setupSchema/Questions.js
@@ -0,0 +1,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');
+ let 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;