Skip to content

Commit bd3736d

Browse files
committed
config: fix parsing of FaradayDir config option
Set the `faradayDirSet` boolean before namespacing the directory with the network. This fixes a bug where the user would _not_ set faradayDir but would set the macaroon path and would run into the "faradaydir overwrites macaroonpath..." error.
1 parent 8e6b4b5 commit bd3736d

File tree

1 file changed

+4
-1
lines changed

1 file changed

+4
-1
lines changed

config.go

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -192,6 +192,10 @@ func ValidateConfig(config *Config) error {
192192
config.TLSKeyPath = lncfg.CleanAndExpandPath(config.TLSKeyPath)
193193
config.MacaroonPath = lncfg.CleanAndExpandPath(config.MacaroonPath)
194194

195+
// Before adding the network namespace below, check if the user has
196+
// overwritten the default faraday directory.
197+
faradayDirSet := config.FaradayDir != FaradayDirBase
198+
195199
// Append the network type to faraday directory so they are "namespaced"
196200
// per network.
197201
config.FaradayDir = filepath.Join(config.FaradayDir, config.Network)
@@ -205,7 +209,6 @@ func ValidateConfig(config *Config) error {
205209
// values, make sure that they are not set when faraday dir is set. We
206210
// fail hard here rather than overwriting and potentially confusing the
207211
// user.
208-
faradayDirSet := config.FaradayDir != FaradayDirBase
209212
if faradayDirSet {
210213
tlsCertPathSet := config.TLSCertPath != DefaultTLSCertPath
211214
tlsKeyPathSet := config.TLSKeyPath != DefaultTLSKeyPath

0 commit comments

Comments
 (0)