From f204487b780ce7028bc528ec42903ded72c9ccb4 Mon Sep 17 00:00:00 2001 From: Torkel Rogstad Date: Thu, 30 Nov 2017 16:20:24 +0100 Subject: [PATCH] proper linux and win cert handling --- app/lnd/config/index.js | 20 ++++++++++++++++++-- 1 file changed, 18 insertions(+), 2 deletions(-) diff --git a/app/lnd/config/index.js b/app/lnd/config/index.js index 0b79a5e6..fb37f404 100644 --- a/app/lnd/config/index.js +++ b/app/lnd/config/index.js @@ -2,10 +2,26 @@ // Mac OS X: /Users/user/Library/Application Support/Lnd/tls.cert // Linux: ~/.lnd/tls.cert // Windows: TODO find out where cert is located for windows machine -import { userInfo } from 'os' +import { userInfo, platform } from 'os' +import { join } from 'path' + +let loc +switch (platform()) { + case 'darwin': + loc = 'Library/Application\ Support/Lnd/tls.cert' + break + case 'linux': + loc = '.lnd/tls.cert' + break + case 'win32': + loc = join('Appdata', 'Local', 'Lnd', 'tls.cert') + break + default: + break +} export default { lightningRpc: `${__dirname}/rpc.proto`, lightningHost: 'localhost:10009', - cert: `/Users/${userInfo().username}/Library/Application Support/Lnd/tls.cert` + cert: join(userInfo().homedir, loc) }