node_config: load() returns true on parse success; main: specific diagnostics per missing field
This commit is contained in:
1 parent
4d9f940d68
commit
15599e4ca3
2 files changed
+9
-4
No files matched your search
@@ -42,11 +42,16 @@ int main(int argc, char *argv[]) {
|
||||
}
|
||||
} else {
|
||||
if (!cfg.load()) {
|
||||
qCritical("Failed to load config: %s", qPrintable(cfgPath));
|
||||
qCritical("Cannot open/read config file: %s", qPrintable(cfgPath));
|
||||
return 1;
|
||||
}
|
||||
if (cfg.privKey().length() != 64 || cfg.pubKey().length() != 64 ||
|
||||
cfg.nodeId().length() != 16) {
|
||||
if (cfg.privKey().length() != 64 || cfg.pubKey().length() != 64) {
|
||||
qWarning("Config: keys missing/invalid, regenerating identity");
|
||||
cfg.generateIdentity();
|
||||
needSave = true;
|
||||
}
|
||||
if (cfg.nodeId().length() != 16) {
|
||||
qWarning("Config: my_node_id missing/invalid, regenerating identity");
|
||||
cfg.generateIdentity();
|
||||
needSave = true;
|
||||
}
|
||||
|
||||
@@ -134,7 +134,7 @@ bool NodeConfig::load() {
|
||||
if (!controlIp.isEmpty() && !controlPort.isEmpty())
|
||||
m_controlAddr = controlIp + ":" + controlPort;
|
||||
|
||||
return !m_nodeId.isEmpty();
|
||||
return true;
|
||||
}
|
||||
|
||||
bool NodeConfig::save() {
|
||||
|
||||
Reference in new issue
Block a user