Comparing version 1.0.2 to 1.0.3
//Parse standard server command line parameters | ||
//Copyright WyattERP.org; See license in root of this package | ||
// ----------------------------------------------------------------------------- | ||
const Path = require("path") | ||
const DefConfig = { | ||
@@ -8,4 +9,4 @@ spaPort: 4000, | ||
dbAdmin: 'admin', | ||
serverKey: process.env.WYCLIF_SERVER_KEY || __dirname + '/../pki/server_private_key.pem', | ||
serverCert: process.env.WYCLIF_SERVER_CERT || __dirname + '/../pki/server_certificate.pem', | ||
serverKey: process.env.WYCLIF_SERVER_KEY || Path.join(__dirname,'/../pki/server_private_key.pem'), | ||
serverCert: process.env.WYCLIF_SERVER_CERT || Path.join(__dirname,'/../pki/server_certificate.pem'), | ||
} | ||
@@ -19,4 +20,6 @@ | ||
.alias('i','clifPort') .default('clifPort', d.clifPort) //Access to control layer interface | ||
.alias('k','serverKey') .default('serverKey', d.serverKey) //Private SSL key for this server | ||
.alias('c','serverCert') .default('serverCert', d.serverCert) //SSL Certificate for this server | ||
.alias('k','spaKey') .default('spaKey', d.spaKey) //Private SSL key for this SPA server | ||
.alias('c','spaCert') .default('spaCert', d.spaCert) //SSL Certificate for this SPA server | ||
.alias('w','wysegi') .default('wysegi', d.wysegi) //Serve wysegi SPA | ||
.alias('n','noHTTPS') .default('noHTTPS', false) //Do not run SPA server over SSL | ||
.alias('D','dbName') .default('dbName', d.dbName) //Database name | ||
@@ -26,4 +29,8 @@ .alias('P','dbPassword') .default('dbPassword', d.dbPassword) //Database password | ||
.alias('H','dbHost') .default('dbHost', d.dbHost) //Database host computer | ||
.alias('w','wysegi') .default('wysegi', d.wysegi) //Serve wysegi SPA | ||
.alias('n','noSSL') .default('noSSL', false) //Do not run server with SSL | ||
.alias('Q','dbPort') .default('dbPort', d.dbPort) //Database connection port | ||
.alias('K','dbUserKey') .default('dbUserKey', d.dbUserKey) | ||
.alias('C','dbUserCert') .default('dbUserCert', d.dbUserCert) | ||
.alias('W','dbAdminKey') .default('dbAdminKey', d.dbAdminKey) | ||
.alias('X','dbAdminCert').default('dbAdminCert',d.dbAdminCert) | ||
.alias('Y','dbCA') .default('dbCA', d.dbCA) | ||
} |
@@ -6,16 +6,29 @@ //Create a credentials object from specified files | ||
module.exports = function(serverKeyFile, serverCertFile, log) { | ||
let key, cert | ||
module.exports = function(keyFile, certFile, caFile, log) { | ||
let key, cert, ca | ||
console.log("Credentials:", keyFile, certFile, caFile, !!log) | ||
if (Fs.existsSync(keyFile)) { | ||
key = Fs.readFileSync(keyFile) | ||
} else if (log) { | ||
log.error("Can't find key file:", keyFile) | ||
} | ||
if (Fs.existsSync(certFile)) | ||
cert = Fs.readFileSync(certFile) | ||
else if (log) | ||
log.error("Can't find certificate file:", certFile) | ||
if (Fs.existsSync(serverKeyFile)) | ||
key = Fs.readFileSync(serverKeyFile) | ||
else | ||
log.error("Can't find server key file:", serverKeyFile) | ||
if (Fs.existsSync(serverCertFile)) | ||
cert = Fs.readFileSync(serverCertFile) | ||
else | ||
log.error("Can't find server certificate file:", serverCertFile) | ||
return {key, cert} | ||
if (caFile) { | ||
if (Fs.existsSync(caFile)) | ||
ca = Fs.readFileSync(caFile) | ||
else if (log) | ||
log.error("Can't find CA file:", caFile) | ||
} | ||
if (key && cert && ca) { | ||
return {key, cert, ca} | ||
} else if (key && cert) { | ||
return {key, cert} | ||
} | ||
return null | ||
} |
{ | ||
"name": "wyclif", | ||
"version": "1.0.2", | ||
"version": "1.0.3", | ||
"description": "WyattERP Control Layer InterFace", | ||
@@ -5,0 +5,0 @@ "main": "lib/index.js", |
24197
17
265