/* * This file is part of the Flowee project * Copyright (C) 2019-2025 Tom Zander * * This program is free software: you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation, either version 3 of the License, or * (at your option) any later version. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License * along with this program. If not, see . */ #include "BackupWebServer.h" #include #include #include // for ECC_Start() namespace { struct ECC_State { ECC_State() { // Init crypto lib. ECC_Start(); globalVerifyHandle.reset(new ECCVerifyHandle()); } ~ECC_State() { globalVerifyHandle.reset(); ECC_Stop(); } std::unique_ptr globalVerifyHandle; }; } int main(int argc, char **argv) { FloweeServiceApplication app(argc, argv); app.setOrganizationName("flowee"); app.setOrganizationDomain("flowee.org"); app.setApplicationName("wallet-backup-server"); QCommandLineParser parser; parser.setApplicationDescription("Wallet Backup Server"); parser.addHelpOption(); QCommandLineOption conf(QStringList() << "conf", "config file", "FILENAME"); parser.addOption(conf); app.addServerOptions(parser); parser.process(app.arguments()); app.setup("walletBackup.log", parser.value(conf)); QString confFile; if (parser.isSet(conf)) { confFile = parser.value(conf); } else { // the next one expects [configs]/flowee/bitcore-proxy/bitcore-proxy.conf confFile = QStandardPaths::locate(QStandardPaths::AppConfigLocation, "walletBackup.conf"); if (confFile.isEmpty()) // the next one expects [configs]/flowee/bitcore-proxy.conf confFile = QStandardPaths::locate(QStandardPaths::ConfigLocation, "flowee/walletBackup.conf"); if (confFile.isEmpty()) { logCritical() << "No config file (walletBackup.conf) found, assuming defaults"; for (auto &dir : QStandardPaths::standardLocations(QStandardPaths::AppConfigLocation)) { logInfo() << " - not found in" << dir + '/'; } } } BackupWebServer server; server.loadConfig(confFile); ECC_State crypo_state; // allows the secp256k1 to function. QObject::connect (&app, SIGNAL(reparseConfig()), &server, SLOT(reparseConfig())); return app.exec(); }