From 61e258e3fba9914ff663ced12ccdc7336030afce Mon Sep 17 00:00:00 2001 From: bill bittner Date: Wed, 15 Aug 2018 13:53:09 -0700 Subject: [PATCH] added node-ip and updated CLI --- cli/configure.js | 7 ++++++- package-lock.json | 5 +++++ package.json | 1 + 3 files changed, 12 insertions(+), 1 deletion(-) diff --git a/cli/configure.js b/cli/configure.js index c1a00ebd..195cf69b 100644 --- a/cli/configure.js +++ b/cli/configure.js @@ -2,6 +2,7 @@ const inquirer = require('inquirer'); const fs = require('fs'); const Path = require('path'); const axios = require('axios'); +const ip = require('ip'); const mysqlQuestions = require(Path.resolve(__dirname, 'questions/mysqlQuestions.js')); const siteQuestions = require(Path.resolve(__dirname, 'questions/siteQuestions.js')); @@ -158,7 +159,11 @@ inquirer siteConfig['details']['port'] = results.port; siteConfig['details']['title'] = results.title; siteConfig['details']['host'] = results.host; + siteConfig['details']['ipAddress'] = ip.address(); siteConfig['publishing']['uploadDirectory'] = results.uploadDirectory; + }) + .then(() => { + // create the siteConfig.json file const fileLocation = Path.resolve(__dirname, '../config/siteConfig.json'); const fileContents = JSON.stringify(siteConfig, null, 2); fs.writeFileSync(fileLocation, fileContents, 'utf-8'); @@ -166,7 +171,7 @@ inquirer }) .then(() => { console.log('\nYou\'re all done!'); - console.log('Next step: run "npm run build" to build your server, then "npm run start" to start your server!'); + console.log('Next step: run "npm run start" to build and start your server!'); console.log('If you want to change any settings, you can edit the files in the "/config" folder.'); process.exit(0); }) diff --git a/package-lock.json b/package-lock.json index 1e3df17c..8b53e846 100644 --- a/package-lock.json +++ b/package-lock.json @@ -6677,6 +6677,11 @@ "resolved": "https://registry.npmjs.org/invert-kv/-/invert-kv-1.0.0.tgz", "integrity": "sha1-EEqOSqym09jNFXqO+L+rLXo//bY=" }, + "ip": { + "version": "1.1.5", + "resolved": "https://registry.npmjs.org/ip/-/ip-1.1.5.tgz", + "integrity": "sha1-vd7XARQpCCjAoDnnLvJfWq7ENUo=" + }, "ip-regex": { "version": "2.1.0", "resolved": "https://registry.npmjs.org/ip-regex/-/ip-regex-2.1.0.tgz", diff --git a/package.json b/package.json index 2ef67840..9ec72eda 100644 --- a/package.json +++ b/package.json @@ -54,6 +54,7 @@ "helmet": "^3.13.0", "image-size": "^0.6.3", "inquirer": "^5.2.0", + "ip": "^1.1.5", "make-dir": "^1.3.0", "module-alias": "^2.1.0", "mysql2": "^1.6.1",