File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -70,16 +70,31 @@ var argv = require('nomnom')
7070 } )
7171 . parse ( ) ;
7272
73+ // Print version and leave
7374if ( 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
7893process . env . DEBUG = argv . verbose ? 'ldnode:*' : false ;
7994var debug = require ( '../logging' ) . server ;
8095var ldnode = require ( '../index' ) ;
8196
82- // Signal handling
97+ // Signal handling (e.g. CTRL+C)
8398if ( 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
92107var 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
Original file line number Diff line number Diff 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 ) ;
You can’t perform that action at this time.
0 commit comments