mirror of
https://gitlab.com/spaceti-app/integrations/acs/colnod-connector.git
synced 2026-07-12 15:20:44 +02:00
58 lines
1.7 KiB
C++
58 lines
1.7 KiB
C++
#include <QCoreApplication>
|
|
#include <QCommandLineParser>
|
|
|
|
#include <serversdk/requestmanager.h>
|
|
#include <serversdk/request.h>
|
|
#include <serversdk/logger.h>
|
|
#include <serversdk/core.h>
|
|
|
|
#include "../colnod/colnodapi.h"
|
|
#include "../colnod/syncmanager.h"
|
|
|
|
int main(int argc, char *argv[])
|
|
{
|
|
// App setup
|
|
QCoreApplication app(argc, argv);
|
|
QCoreApplication::setApplicationName("colnod-connector");
|
|
QCoreApplication::setApplicationVersion("1.0");
|
|
|
|
// Command line parsing
|
|
QCommandLineParser parser;
|
|
parser.setApplicationDescription("Colnod sync");
|
|
QCommandLineOption dryModeOption("dryMode", "Read-only mode, prints changes which would normally be made");
|
|
QCommandLineOption dropTablesOption("dropTables", "ColnodAPI", "Delete tables with datas from Colnod");
|
|
QCommandLineOption createTablesOption("createTables", "ColnodAPI", "Create tables for saving data from Colnod");
|
|
parser.addOption(dryModeOption);
|
|
parser.addOption(dropTablesOption);
|
|
parser.addOption(createTablesOption);
|
|
parser.process(app);
|
|
|
|
|
|
// Logger initializiaton
|
|
serversdk::initAppLogger();
|
|
|
|
// Log messge Filtering
|
|
QStringList filters;
|
|
// filters << "qt.*=false";
|
|
// filters << "sdk*=false";
|
|
//filters << "*=false";
|
|
QLoggingCategory::setFilterRules(filters.join(QStringLiteral("\n")));
|
|
|
|
|
|
SyncManager syncManager(parser.isSet(dryModeOption));
|
|
|
|
// Initialize database and colnod API
|
|
if (!syncManager.databaseInitialization()) {
|
|
qCritical() << "Not possible to initialize sync application";
|
|
return -1;
|
|
}
|
|
|
|
// Synchronizaiton
|
|
if (!syncManager.startSynchronization()) {
|
|
qCritical() << "Not possible to start synchronization";
|
|
return -1;
|
|
}
|
|
|
|
return QCoreApplication::exec();
|
|
}
|