Skip to content

Commit

Permalink
moved configuration from package.json (config.json)
Browse files Browse the repository at this point in the history
  • Loading branch information
isabolic committed Jan 23, 2018
1 parent 2680392 commit b0c55f6
Show file tree
Hide file tree
Showing 5 changed files with 20 additions and 6 deletions.
5 changes: 5 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
nohup.out
._*
logs/
config.json
node_modules
7 changes: 6 additions & 1 deletion README.md
100644 → 100755
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,12 @@ from **build** directory:
```bash
npm install
```
5) go into node.server and edit file package.json, there you set node.js port and server ip address or hostname
5) inside node.server, copy or rename file config.json.org
```bash
cd node.server
cp config.json.org config.json
```
5) then edit file config.json, there you set node.js port and server ip address or hostname
```javascript
...
"port" : "SERVER_PORT",
Expand Down
6 changes: 3 additions & 3 deletions node.server/chat.js
Original file line number Diff line number Diff line change
Expand Up @@ -15,10 +15,10 @@
const winston = require('winston');
const mkdirp = require('mkdirp');
const ip = require("ip");
const pjson = require('./package.json');
const pjson = require('./config.json');

const server_port = pjson.port;
const server_ip_address = pjson.server || ip.address();
const server_port = pjson.options.port;
const server_ip_address = pjson.options.server || ip.address();


let app = express();
Expand Down
6 changes: 6 additions & 0 deletions node.server/config.json.org
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
{
"options": {
"port": "PORT",
"server": "IP_ADD_OR_HOST"
}
}
2 changes: 0 additions & 2 deletions node.server/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -6,8 +6,6 @@
"scripts": {
"start": "node chat.js &"
},
"port" : "SERVER_PORT",
"server" : "SERVER_HOST (OR IP)",
"author": "isabolic (sabolic.ivan@gmail.com)",
"license": "MIT",
"dependencies": {
Expand Down

0 comments on commit b0c55f6

Please sign in to comment.