mirror of
https://github.com/lightningnetwork/lnd.git
synced 2025-07-28 13:52:55 +02:00
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.
This commit is contained in:
19
config.go
19
config.go
@@ -860,6 +860,18 @@ func LoadConfig(interceptor signal.Interceptor) (*Config, error) {
|
||||
func ValidateConfig(cfg Config, interceptor signal.Interceptor, fileParser,
|
||||
flagParser *flags.Parser) (*Config, error) {
|
||||
|
||||
// Special show command to list supported subsystems and exit.
|
||||
if cfg.DebugLevel == "show" {
|
||||
subLogMgr := build.NewSubLoggerManager()
|
||||
|
||||
// Initialize logging at the default logging level.
|
||||
SetupLoggers(subLogMgr, interceptor)
|
||||
|
||||
fmt.Println("Supported subsystems",
|
||||
subLogMgr.SupportedSubsystems())
|
||||
os.Exit(0)
|
||||
}
|
||||
|
||||
// If the provided lnd directory is not the default, we'll modify the
|
||||
// path to all of the files and directories that will live within it.
|
||||
lndDir := CleanAndExpandPath(cfg.LndDir)
|
||||
@@ -1408,13 +1420,6 @@ func ValidateConfig(cfg Config, interceptor signal.Interceptor, fileParser,
|
||||
// Initialize logging at the default logging level.
|
||||
SetupLoggers(cfg.SubLogMgr, interceptor)
|
||||
|
||||
// Special show command to list supported subsystems and exit.
|
||||
if cfg.DebugLevel == "show" {
|
||||
fmt.Println("Supported subsystems",
|
||||
cfg.SubLogMgr.SupportedSubsystems())
|
||||
os.Exit(0)
|
||||
}
|
||||
|
||||
if cfg.MaxLogFiles != 0 {
|
||||
if cfg.LogConfig.File.MaxLogFiles !=
|
||||
build.DefaultMaxLogFiles {
|
||||
|
Reference in New Issue
Block a user