Skip to content

Commit

Permalink
Make possible for key and cert options to take sys path to file as va…
Browse files Browse the repository at this point in the history
…lue.
  • Loading branch information
sergibondarenko committed Feb 14, 2018
1 parent 5f4e035 commit 1e33786
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 6 deletions.
4 changes: 2 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -26,8 +26,8 @@ const config = {
cert: {
selfsigned: true,
valid: 10,
key: null,
cert: null,
key: null, // full sys path to pem key file
cert: null, // full sys path to cert file
},
gun: {
port: 9000,
Expand Down
9 changes: 5 additions & 4 deletions src/server.js
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
const fs = require('fs');
const gun = require('gun');
const Hapi = require('hapi');
const Promise = require('bluebird');
Expand All @@ -17,8 +18,8 @@ class Server {
* {object} cert:
* {boolean} selfsigned - certificate
* {integer} valid - for n days
* {string} key - pem
* {string} cert
* {string} key - full sys path for pem key
* {string} cert - full sys path for certificate
*/
constructor(config) {
this.config = config;
Expand Down Expand Up @@ -69,8 +70,8 @@ class Server {
});
}
const keys = {
serviceKey: this.config.cert.key,
certificate: this.config.cert.cert,
serviceKey: fs.readFileSync(this.config.cert.key),
certificate: fs.readFileSync(this.config.cert.cert),
};
return this.runHapi(keys);
}
Expand Down

0 comments on commit 1e33786

Please sign in to comment.