Skip to content
This repository was archived by the owner on Feb 25, 2019. It is now read-only.

Commit 0b59639

Browse files
conditional decoding of key pair environment variables
1 parent 5d996f2 commit 0b59639

File tree

1 file changed

+7
-2
lines changed

1 file changed

+7
-2
lines changed

config/server.js

+7-2
Original file line numberDiff line numberDiff line change
@@ -560,8 +560,13 @@ module.exports = function (server) {
560560

561561
// first, look for environment variables.
562562
// in production, the files should not be present
563-
privateKey = new Buffer(process.env.ANVIL_CONNECT_PRIVATE_KEY, 'base64').toString('ascii')
564-
publicKey = new Buffer(process.env.ANVIL_CONNECT_PUBLIC_KEY, 'base64').toString('ascii')
563+
if (process.env.ANVIL_CONNECT_PRIVATE_KEY) {
564+
privateKey = new Buffer(process.env.ANVIL_CONNECT_PRIVATE_KEY, 'base64').toString('ascii');
565+
}
566+
567+
if (process.env.ANVIL_CONNECT_PUBLIC_KEY) {
568+
publicKey = new Buffer(process.env.ANVIL_CONNECT_PUBLIC_KEY, 'base64').toString('ascii');
569+
}
565570

566571
// next, try to read the key files
567572
// if they are available locally, they should override

0 commit comments

Comments
 (0)