forked from superfeedr/xmpp-server
-
Notifications
You must be signed in to change notification settings - Fork 0
/
xmpp-server.js
executable file
·38 lines (28 loc) · 1009 Bytes
/
xmpp-server.js
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
#!/usr/bin/env node
var path = require('path'),
config = require('jsconfig'),
defaultConfigPath = path.join(__dirname, "config.default.js");
config.defaults(defaultConfigPath);
// environment parameters
config.set('env', {
DOMAIN: 'domain',
PORT: ['port', parseInt],
});
config.cli({
domain: ['domain', ['d', "xmpp server domain", 'host']],
port: ['port', ['p', "xmpp server port", 'number']],
config: ['c', "load config file", 'path', defaultConfigPath],
logger: ['logger', [false, "Log to stdout"]],
websocket: ['websocket', [false, "Do not listen on websocket connections"]],
});
config.load(function (args, opts) {
// preserve the old api with loading a config file from argv
if(args.length > 0)
opts.config = args[args.length - 1];
if(opts.config !== defaultConfigPath)
config.merge(require(opts.config));
var server = require('./lib/server.js');
server.run(config, function() {
// Server ready!
});
});