allow servatrice to exit early based on commandline options (#4504)

This commit is contained in:
ebbit1q 2021-12-26 16:47:37 +01:00 committed by GitHub
parent 07e6aadbbe
commit a9f2fc427b
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
4 changed files with 17 additions and 9 deletions

View file

@ -30,6 +30,7 @@
#include <QCommandLineParser>
#include <QCoreApplication>
#include <QDateTime>
#include <QFile>
#include <QMetaType>
#include <QTextCodec>
#include <QtGlobal>
@ -140,7 +141,12 @@ int main(int argc, char *argv[])
qRegisterMetaType<QList<int>>("QList<int>");
configPath = SettingsCache::guessConfigurationPath(configPath);
if (configPath.isEmpty()) {
configPath = SettingsCache::guessConfigurationPath();
} else if (!QFile::exists(configPath)) {
qCritical() << "Could not find configuration file at" << configPath;
return 1;
}
qWarning() << "Using configuration file: " << configPath;
settingsCache = new SettingsCache(configPath);
@ -167,10 +173,15 @@ int main(int argc, char *argv[])
PasswordHasher::initialize();
if (testRandom)
if (testRandom) {
testRNG();
if (testHashFunction)
}
if (testHashFunction) {
testHash();
}
if (testRandom || testHashFunction) {
return 0;
}
smtpClient = new SmtpClient();