Skip to content

Commit a4d4fa4

Browse files
author
nicola
committed
cleaning options.js
1 parent 7da589d commit a4d4fa4

1 file changed

Lines changed: 17 additions & 13 deletions

File tree

‎options.js‎

Lines changed: 17 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -10,21 +10,28 @@ module.exports = params;
1010

1111
function params(argv) {
1212
var opts = {};
13+
14+
// From input
15+
opts.cache = argv.cache;
16+
opts.live = argv.live;
17+
opts.path = opts.fileBase = argv.fileBase || process.cwd();
18+
opts.port = argv.port;
19+
opts.secret = argv.secret;
20+
opts.ssl = argv.ssl;
21+
// TODO no need of uriBase
22+
opts.uri = opts.uriBase = argv.uriBase;
23+
opts.verbose = argv.verbose;
24+
opts.webid = argv.webid;
25+
26+
// Processed
1327
opts.leavePatchConnectionOpen = false;
1428
opts.aclSuffix = argv.aclSuffix || ",acl";
15-
opts.uriBase = argv.uriBase ||
16-
'http://localhost:3000' + process.cwd() + '/test/';
17-
opts.fileBase = argv.fileBase || process.cwd();
29+
1830
if (!(S(opts.fileBase).endsWith('/'))) {
1931
opts.fileBase += '/';
2032
}
21-
opts.address = argv.a || '0.0.0.0';
22-
opts.verbose = argv.v;
2333
opts.changesSuffix = argv.changesSuffix || ',changes';
2434
opts.SSESuffix = argv.SSESuffix || ',events';
25-
opts.ssl = argv.ssl;
26-
opts.cors = argv.cors;
27-
debug("uriBase: " + opts.uriBase);
2835

2936
opts.pathStart = '/' +
3037
opts.uriBase
@@ -38,18 +45,15 @@ function params(argv) {
3845
.slice(0, 3)
3946
.join('/');
4047

41-
debug("URI pathStart: " + opts.pathStart);
4248
opts.pathFilter = regexp().start(opts.pathStart).toRegExp();
4349
opts.xssProxy = argv.xssProxy;
4450
opts.proxyFilter = regexp().start(opts.xssProxy).toRegExp();
45-
opts.live = argv.live;
46-
opts.webid = argv.webid ? true : false;
47-
opts.privateKey = argv.privateKey || path.join(opts.fileBase, 'key.pem');
48-
opts.cert = argv.cert || path.join(opts.fileBase, 'cert.pem');
4951

5052
// TODO this should be an attribute of an object
5153
opts.usedURIs = {};
5254

55+
debug("uriBase: " + opts.uriBase);
56+
debug("pathStart: " + opts.pathStart);
5357
debug("URI path filter regexp: " + opts.pathFilter);
5458
debug("Verbose: " + !!opts.verbose);
5559
debug("Live: " + !!opts.live);

0 commit comments

Comments
 (0)