Skip to content

Commit 52aee37

Browse files
committed
addressing ssl/webid issue and fixing port argv
1 parent 8d9a618 commit 52aee37

2 files changed

Lines changed: 25 additions & 9 deletions

File tree

bin/ldnode.js

Lines changed: 20 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -70,16 +70,31 @@ var argv = require('nomnom')
7070
})
7171
.parse();
7272

73+
// Print version and leave
7374
if (argv.version) {
7475
return;
7576
}
7677

77-
argv.webid = !argv.noWebid;
78+
// Set up webid
79+
if (argv.noWebid) {
80+
argv.webid = {key: argv.webidKey, cert: argv.webidCert}
81+
} else {
82+
argv.webid = false;
83+
}
84+
85+
// Set up ssl
86+
if (argv.noSsl) {
87+
argv.ssl = {key: argv.sslKey, cert: argv.sslCert}
88+
} else {
89+
argv.ssl = false;
90+
}
91+
92+
// Set up debug environment
7893
process.env.DEBUG = argv.verbose ? 'ldnode:*' : false;
7994
var debug = require('../logging').server;
8095
var ldnode = require('../index');
8196

82-
// Signal handling
97+
// Signal handling (e.g. CTRL+C)
8398
if (process.platform !== 'win32') {
8499
// Signal handlers don't work on Windows.
85100
process.on('SIGINT', function() {
@@ -88,9 +103,9 @@ if (process.platform !== 'win32') {
88103
});
89104
}
90105

91-
// Starting ldnode
106+
// Finally starting ldnode
92107
var app = ldnode.createServer(argv);
93-
app.listen(argv.p, function() {
94-
debug('LDP started on port ' + argv.p);
108+
app.listen(argv.port, function() {
109+
debug('LDP started on port ' + argv.port);
95110
});
96111

index.js

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -72,11 +72,12 @@ function createServer(argv) {
7272

7373
var app = ldnode(argv);
7474
var opts = app.locals.ldp;
75-
76-
if (app.locals.ldp && app.locals.ldp.webid) {
75+
76+
if (opts.ldp && (opts.webid || opts.ssl )) {
77+
var ssl = opts.webid || opts.ssl;
7778
var credentials = {
78-
key: fs.readFileSync(opts.privateKey),
79-
cert: fs.readFileSync(opts.cert),
79+
key: fs.readFileSync(ssl.key),
80+
cert: fs.readFileSync(ssl.cert),
8081
requestCert: true
8182
};
8283
debug("Private Key: " + credentials.key);

0 commit comments

Comments
 (0)