mirror of
https://github.com/cubixle/cli-chat.git
synced 2026-04-24 19:44:47 +01:00
added config setup
This commit is contained in:
3
.gitignore
vendored
3
.gitignore
vendored
@@ -25,3 +25,6 @@ build/Release
|
||||
# Dependency directory
|
||||
# https://www.npmjs.org/doc/misc/npm-faq.html#should-i-check-my-node_modules-folder-into-git
|
||||
node_modules
|
||||
|
||||
# config file
|
||||
config.js
|
||||
11
chat.js
11
chat.js
@@ -1,7 +1,8 @@
|
||||
// Load the TCP Library
|
||||
net = require('net');
|
||||
clc = require('cli-color');
|
||||
moment = require('moment');
|
||||
var net = require('net'),
|
||||
clc = require('cli-color'),
|
||||
moment = require('moment'),
|
||||
config = require('./config');
|
||||
|
||||
// Keep track of the chat clients
|
||||
var clients = [];
|
||||
@@ -106,7 +107,7 @@ net.createServer(function (socket) {
|
||||
socket.on('end', function () {
|
||||
clientService.removeUser(socket);
|
||||
});
|
||||
}).listen(5000);
|
||||
}).listen(config.server.port);
|
||||
|
||||
// Put a friendly message on the terminal of the server.
|
||||
console.log("Chat server running at port 5000");
|
||||
console.log("Chat server running at port " + config.server.port);
|
||||
|
||||
6
config.example.js
Normal file
6
config.example.js
Normal file
@@ -0,0 +1,6 @@
|
||||
var config = {};
|
||||
|
||||
config.server = {};
|
||||
config.server.port ='5000';
|
||||
|
||||
module.exports = config;
|
||||
Reference in New Issue
Block a user