add --access flag for debugging

This commit is contained in:
mrbesen 2023-09-02 11:52:18 +02:00
parent 5d0795dbd0
commit 2cacbfe27f
Signed by: MrBesen
GPG Key ID: 596B2350DCD67504
3 changed files with 8 additions and 0 deletions

View File

@ -2,6 +2,7 @@
struct Args { struct Args {
int debugLog = 0; // cast to bool later int debugLog = 0; // cast to bool later
int access = 0;
}; };
Args parseArgs(int argc, char** argv); Args parseArgs(int argc, char** argv);

View File

@ -9,6 +9,7 @@ Args parseArgs(int argc, char** argv) {
while (1) { while (1) {
static struct option long_options[] = { static struct option long_options[] = {
{"debug-log", no_argument, &a.debugLog, 1}, {"debug-log", no_argument, &a.debugLog, 1},
{"access", no_argument, &a.access, 1},
{0, 0, 0, 0} {0, 0, 0, 0}
}; };
/* getopt_long stores the option index here. */ /* getopt_long stores the option index here. */

View File

@ -32,6 +32,12 @@ int main(int argc, char** argv) {
qInfo() << "Hello, World!"; qInfo() << "Hello, World!";
qInfo() << "Using Locale: " << QLocale().name(); qInfo() << "Using Locale: " << QLocale().name();
if(args.access) {
auto access = ClientAccess::find();
qInfo() << "Access: port=" << access->getPort() << " basicAuth=" << access->getBasicAuth();
return 0;
}
QApplication app(argc, argv); QApplication app(argc, argv);
QTranslator translator; QTranslator translator;
if(translator.load(QLocale().name(), ":/i18n")) { if(translator.load(QLocale().name(), ":/i18n")) {