config: better error message if config file doesn't exist
This commit is contained in:
1 parent
f553462bf4
commit
0f167fd03e
2 files changed
+16
-6
No files matched your search
@@ -633,11 +633,22 @@ func LoadConfig(interceptor signal.Interceptor) (*Config, error) {
|
|||||||
// file within it.
|
// file within it.
|
||||||
configFileDir := CleanAndExpandPath(preCfg.LndDir)
|
configFileDir := CleanAndExpandPath(preCfg.LndDir)
|
||||||
configFilePath := CleanAndExpandPath(preCfg.ConfigFile)
|
configFilePath := CleanAndExpandPath(preCfg.ConfigFile)
|
||||||
if configFileDir != DefaultLndDir {
|
switch {
|
||||||
if configFilePath == DefaultConfigFile {
|
// User specified --lnddir but no --configfile. Update the config file
|
||||||
configFilePath = filepath.Join(
|
// path to the lnd config directory, but don't require it to exist.
|
||||||
configFileDir, lncfg.DefaultConfigFilename,
|
case configFileDir != DefaultLndDir &&
|
||||||
)
|
configFilePath == DefaultConfigFile:
|
||||||
|
|
||||||
|
configFilePath = filepath.Join(
|
||||||
|
configFileDir, lncfg.DefaultConfigFilename,
|
||||||
|
)
|
||||||
|
|
||||||
|
// User did specify an explicit --configfile, so we check that it does
|
||||||
|
// exist under that path to avoid surprises.
|
||||||
|
case configFilePath != DefaultConfigFile:
|
||||||
|
if !fileExists(configFilePath) {
|
||||||
|
return nil, fmt.Errorf("specified config file does "+
|
||||||
|
"not exist in %s", configFilePath)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -226,7 +226,6 @@ func (cfg *BaseNodeConfig) GenArgs() []string {
|
|||||||
fmt.Sprintf("--datadir=%v", cfg.DataDir),
|
fmt.Sprintf("--datadir=%v", cfg.DataDir),
|
||||||
fmt.Sprintf("--tlscertpath=%v", cfg.TLSCertPath),
|
fmt.Sprintf("--tlscertpath=%v", cfg.TLSCertPath),
|
||||||
fmt.Sprintf("--tlskeypath=%v", cfg.TLSKeyPath),
|
fmt.Sprintf("--tlskeypath=%v", cfg.TLSKeyPath),
|
||||||
fmt.Sprintf("--configfile=%v", cfg.DataDir),
|
|
||||||
fmt.Sprintf("--adminmacaroonpath=%v", cfg.AdminMacPath),
|
fmt.Sprintf("--adminmacaroonpath=%v", cfg.AdminMacPath),
|
||||||
fmt.Sprintf("--readonlymacaroonpath=%v", cfg.ReadMacPath),
|
fmt.Sprintf("--readonlymacaroonpath=%v", cfg.ReadMacPath),
|
||||||
fmt.Sprintf("--invoicemacaroonpath=%v", cfg.InvoiceMacPath),
|
fmt.Sprintf("--invoicemacaroonpath=%v", cfg.InvoiceMacPath),
|
||||||
|
|||||||
Reference in new issue
Block a user