move write config from json api to http post (#363)

* implement config save over http post instead of json

* remove json set config
finish config write thrugh http post

* remove debug code and add failure messages
This commit is contained in:
redPanther
2017-01-14 19:04:58 +01:00
committed by GitHub
parent b2a6366176
commit 8a9d2760ef
17 changed files with 204 additions and 141 deletions

View File

@@ -967,10 +967,6 @@ void JsonClientConnection::handleConfigCommand(const QJsonObject& message, const
{
handleConfigGetCommand(message, full_command, tan);
}
else if (subcommand == "setconfig")
{
handleConfigSetCommand(message, full_command, tan);
}
else if (subcommand == "reload")
{
_hyperion->freeObjects();
@@ -1098,28 +1094,6 @@ void JsonClientConnection::handleSchemaGetCommand(const QJsonObject& message, co
sendMessage(result);
}
void JsonClientConnection::handleConfigSetCommand(const QJsonObject& message, const QString &command, const int tan)
{
if(message.size() > 0)
{
if (message.contains("config"))
{
QString errors;
if (!checkJson(message["config"].toObject(), ":/hyperion-schema", errors, true))
{
sendErrorReply("Error while validating json: " + errors, command, tan);
return;
}
QJsonObject hyperionConfig = message["config"].toObject();
QJsonFactory::writeJson(QString::fromStdString(_hyperion->getConfigFileName()), hyperionConfig);
sendSuccessReply(command, tan);
}
} else
sendErrorReply("Error while parsing json: Message size " + QString(message.size()), command, tan);
}
void JsonClientConnection::handleComponentStateCommand(const QJsonObject& message, const QString &command, const int tan)
{
const QJsonObject & componentState = message["componentstate"].toObject();