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:
1 file changed
+12
-7
@@ -860,6 +860,18 @@ func LoadConfig(interceptor signal.Interceptor) (*Config, error) {
|
|||||||
func ValidateConfig(cfg Config, interceptor signal.Interceptor, fileParser,
|
func ValidateConfig(cfg Config, interceptor signal.Interceptor, fileParser,
|
||||||
flagParser *flags.Parser) (*Config, error) {
|
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
|
// 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.
|
// path to all of the files and directories that will live within it.
|
||||||
lndDir := CleanAndExpandPath(cfg.LndDir)
|
lndDir := CleanAndExpandPath(cfg.LndDir)
|
||||||
@@ -1408,13 +1420,6 @@ func ValidateConfig(cfg Config, interceptor signal.Interceptor, fileParser,
|
|||||||
// Initialize logging at the default logging level.
|
// Initialize logging at the default logging level.
|
||||||
SetupLoggers(cfg.SubLogMgr, interceptor)
|
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.MaxLogFiles != 0 {
|
||||||
if cfg.LogConfig.File.MaxLogFiles !=
|
if cfg.LogConfig.File.MaxLogFiles !=
|
||||||
build.DefaultMaxLogFiles {
|
build.DefaultMaxLogFiles {
|
||||||
|
|||||||
Reference in new issue
Block a user