Merge pull request #196 from lightninglabs/default-admin-mac-path

config: fix empty default remote lnd admin mac path
This commit is contained in:
Oliver Gugger 2021-03-05 10:14:23 +01:00 committed by GitHub
commit aad7fc57ba
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -65,6 +65,7 @@ const (
defaultRemotePoolRpcServer = "localhost:12010"
defaultLndChainSubDir = "chain"
defaultLndChain = "bitcoin"
defaultLndMacaroon = "admin.macaroon"
)
var (
@ -104,6 +105,13 @@ var (
defaultLetsEncryptDir = filepath.Join(
defaultLitDir, defaultLetsEncryptSubDir,
)
// defaultRemoteLndMacaroonPath is the default path we assume for a
// local lnd node to store its admin.macaroon file at.
defaultRemoteLndMacaroonPath = filepath.Join(
lndDefaultConfig.DataDir, defaultLndChainSubDir,
defaultLndChain, defaultNetwork, defaultLndMacaroon,
)
)
// Config is the main configuration struct of lightning-terminal. It contains
@ -248,7 +256,7 @@ func defaultConfig() *Config {
LitMaxLogFileSize: defaultMaxLogFileSize,
Lnd: &RemoteDaemonConfig{
RPCServer: defaultRemoteLndRpcServer,
MacaroonPath: lndDefaultConfig.AdminMacPath,
MacaroonPath: defaultRemoteLndMacaroonPath,
TLSCertPath: lndDefaultConfig.TLSCertPath,
},
Faraday: &RemoteDaemonConfig{
@ -526,7 +534,7 @@ func validateRemoteModeConfig(cfg *Config) error {
// specify --network=testnet for example if everything else is using
// the defaults.
if cfg.Network != defaultNetwork &&
r.Lnd.MacaroonPath == defaultLndCfg.AdminMacPath {
r.Lnd.MacaroonPath == defaultRemoteLndMacaroonPath {
r.Lnd.MacaroonPath = filepath.Join(
defaultLndCfg.DataDir, defaultLndChainSubDir,