fix config loading
parent
0845105f3e
commit
6fe6221f62
|
|
@ -30,7 +30,7 @@ bool Engine::exists()
|
||||||
return s_instance != nullptr;
|
return s_instance != nullptr;
|
||||||
}
|
}
|
||||||
|
|
||||||
void Engine::start()
|
void Engine::start(ProxyConfiguration *configuration)
|
||||||
{
|
{
|
||||||
// Make sure an authenticator was registered
|
// Make sure an authenticator was registered
|
||||||
Q_ASSERT_X(m_authenticator != nullptr, "Engine", "There is no authenticator registerd.");
|
Q_ASSERT_X(m_authenticator != nullptr, "Engine", "There is no authenticator registerd.");
|
||||||
|
|
@ -42,7 +42,7 @@ void Engine::start()
|
||||||
// Clean up
|
// Clean up
|
||||||
clean();
|
clean();
|
||||||
|
|
||||||
m_configuration = new ProxyConfiguration(this);
|
m_configuration = configuration;
|
||||||
m_proxyServer = new ProxyServer(this);
|
m_proxyServer = new ProxyServer(this);
|
||||||
m_webSocketServer = new WebSocketServer(m_sslConfiguration, this);
|
m_webSocketServer = new WebSocketServer(m_sslConfiguration, this);
|
||||||
|
|
||||||
|
|
@ -50,6 +50,7 @@ void Engine::start()
|
||||||
websocketServerUrl.setScheme("wss");
|
websocketServerUrl.setScheme("wss");
|
||||||
websocketServerUrl.setHost(m_configuration->webSocketServerHost().toString());
|
websocketServerUrl.setHost(m_configuration->webSocketServerHost().toString());
|
||||||
websocketServerUrl.setPort(m_configuration->webSocketServerPort());
|
websocketServerUrl.setPort(m_configuration->webSocketServerPort());
|
||||||
|
qDebug() << "WSS url is:" << websocketServerUrl;
|
||||||
m_webSocketServer->setServerUrl(websocketServerUrl);
|
m_webSocketServer->setServerUrl(websocketServerUrl);
|
||||||
|
|
||||||
m_proxyServer->registerTransportInterface(m_webSocketServer);
|
m_proxyServer->registerTransportInterface(m_webSocketServer);
|
||||||
|
|
|
||||||
|
|
@ -22,7 +22,7 @@ public:
|
||||||
|
|
||||||
static bool exists();
|
static bool exists();
|
||||||
|
|
||||||
void start();
|
void start(ProxyConfiguration *configuration);
|
||||||
void stop();
|
void stop();
|
||||||
|
|
||||||
bool running() const;
|
bool running() const;
|
||||||
|
|
|
||||||
|
|
@ -25,7 +25,6 @@ bool ProxyConfiguration::loadConfiguration(const QString &fileName)
|
||||||
}
|
}
|
||||||
|
|
||||||
QSettings settings(fileName, QSettings::IniFormat);
|
QSettings settings(fileName, QSettings::IniFormat);
|
||||||
qCDebug(dcApplication()) << settings.childGroups();
|
|
||||||
|
|
||||||
setWriteLogFile(settings.value("writeLogs", false).toBool());
|
setWriteLogFile(settings.value("writeLogs", false).toBool());
|
||||||
setLogFileName(settings.value("logFile", "/var/log/nymea-remoteproxy.log").toString());
|
setLogFileName(settings.value("logFile", "/var/log/nymea-remoteproxy.log").toString());
|
||||||
|
|
@ -141,7 +140,7 @@ QDebug operator<<(QDebug debug, ProxyConfiguration *configuration)
|
||||||
debug.nospace() << " - port:" << configuration->tcpServerPort() << endl;
|
debug.nospace() << " - port:" << configuration->tcpServerPort() << endl;
|
||||||
debug.nospace() << "========== ProxyConfiguration ==========" << endl;
|
debug.nospace() << "========== ProxyConfiguration ==========" << endl;
|
||||||
|
|
||||||
return debug; return debug;
|
return debug;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -229,7 +229,7 @@ int main(int argc, char *argv[])
|
||||||
Engine::instance()->setSslConfiguration(sslConfiguration);
|
Engine::instance()->setSslConfiguration(sslConfiguration);
|
||||||
Engine::instance()->setAuthenticator(authenticator);
|
Engine::instance()->setAuthenticator(authenticator);
|
||||||
|
|
||||||
Engine::instance()->start();
|
Engine::instance()->start(configuration);
|
||||||
|
|
||||||
return application.exec();
|
return application.exec();
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -70,7 +70,7 @@ void RemoteProxyTests::webserverConnectionBlocked()
|
||||||
Engine::instance()->setSslConfiguration(m_sslConfiguration);
|
Engine::instance()->setSslConfiguration(m_sslConfiguration);
|
||||||
|
|
||||||
QSignalSpy runningSpy(Engine::instance(), &Engine::runningChanged);
|
QSignalSpy runningSpy(Engine::instance(), &Engine::runningChanged);
|
||||||
Engine::instance()->start();
|
Engine::instance()->start(m_configuration);
|
||||||
runningSpy.wait();
|
runningSpy.wait();
|
||||||
|
|
||||||
QVERIFY(runningSpy.count() == 1);
|
QVERIFY(runningSpy.count() == 1);
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue