Skip to content

Commit 1bc25c1

Browse files
committed
config: fix "lnd --debuglevel show" command
Previously, "lnd --debuglevel show" complained that bitcoin backend is not configured: $ lnd --debuglevel show failed to load config: ValidateConfig: either --bitcoin.mainnet, or ... To make it working, the user had to specify --bitcoin.mainnet and configure one of the backends, e.g. "--bitcoin.node neutrino". With this fix, the command works without any additional flags.
1 parent 411ad1d commit 1bc25c1

File tree

1 file changed

+12
-7
lines changed

1 file changed

+12
-7
lines changed

config.go

Lines changed: 12 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -860,6 +860,18 @@ func LoadConfig(interceptor signal.Interceptor) (*Config, error) {
860860
func ValidateConfig(cfg Config, interceptor signal.Interceptor, fileParser,
861861
flagParser *flags.Parser) (*Config, error) {
862862

863+
// Special show command to list supported subsystems and exit.
864+
if cfg.DebugLevel == "show" {
865+
subLogMgr := build.NewSubLoggerManager()
866+
867+
// Initialize logging at the default logging level.
868+
SetupLoggers(subLogMgr, interceptor)
869+
870+
fmt.Println("Supported subsystems",
871+
subLogMgr.SupportedSubsystems())
872+
os.Exit(0)
873+
}
874+
863875
// If the provided lnd directory is not the default, we'll modify the
864876
// path to all of the files and directories that will live within it.
865877
lndDir := CleanAndExpandPath(cfg.LndDir)
@@ -1408,13 +1420,6 @@ func ValidateConfig(cfg Config, interceptor signal.Interceptor, fileParser,
14081420
// Initialize logging at the default logging level.
14091421
SetupLoggers(cfg.SubLogMgr, interceptor)
14101422

1411-
// Special show command to list supported subsystems and exit.
1412-
if cfg.DebugLevel == "show" {
1413-
fmt.Println("Supported subsystems",
1414-
cfg.SubLogMgr.SupportedSubsystems())
1415-
os.Exit(0)
1416-
}
1417-
14181423
if cfg.MaxLogFiles != 0 {
14191424
if cfg.LogConfig.File.MaxLogFiles !=
14201425
build.DefaultMaxLogFiles {

0 commit comments

Comments
 (0)