Refactor Settings DB and Handling (#1786)

* Refactor config API

* Corrections

* Test Qt 6.8

* Revert "Test Qt 6.8"

This reverts commit eceebec49e.

* Corrections 2

* Update Changelog

* Add configFilter element for getconfig call

* Do not create errors for DB updates when in read-only mode

* Have configuration migration and validation before Hyperion starts

* Correct Tests

* Corrections

* Add migration items

* Correct windows build

* Ensure that first instance as default one exists

* Remove dependency between AuthManager and SSDPHandler

* Correct typos

* Address CodeQL findings

* Replace CamkeSettings by Presets and provide debug scenarios
This commit is contained in:
LordGrey
2024-09-30 22:03:13 +02:00
committed by GitHub
parent aed4abc03b
commit ecceb4e7ae
88 changed files with 4407 additions and 2472 deletions

View File

@@ -22,7 +22,7 @@ bool loadConfig(const QString & configFile, bool correct, bool ignore)
try
{
schemaJson = QJsonFactory::readSchema(":/hyperion-schema");
schemaJson = QJsonFactory::readSchema(":/schema-settings-default.json");
}
catch(const std::runtime_error& error)
{
@@ -36,7 +36,7 @@ bool loadConfig(const QString & configFile, bool correct, bool ignore)
// read and validate the configuration file from the command line
////////////////////////////////////////////////////////////
QJsonObject jsonConfig = QJsonFactory::readConfig(configFile);
QJsonValue jsonConfig = QJsonFactory::readConfig(configFile);
if (!correct)
{
@@ -56,7 +56,8 @@ bool loadConfig(const QString & configFile, bool correct, bool ignore)
else
{
jsonConfig = schemaChecker.getAutoCorrectedConfig(jsonConfig, ignore); // The second parameter is to ignore the "required" keyword in hyperion schema
QJsonFactory::writeJson(configFile, jsonConfig);
QJsonObject jsonObject = jsonConfig.toObject();
QJsonFactory::writeJson(configFile, jsonObject);
}
return true;

View File

@@ -18,7 +18,7 @@ try:
with open(schemaFileName) as schemaFile:
with open(jsonFileName) as jsonFile:
schema = json.load(schemaFile)
uri = path2url('%s/schema/' % path.abspath(path.dirname(schemaFileName)))
uri = path2url('%s/' % path.abspath(path.dirname(schemaFileName)))
resolver = RefResolver(uri, referrer = schema)
instance = json.load(jsonFile)
Draft3Validator(schema, resolver=resolver).validate(instance)

View File

@@ -44,7 +44,7 @@ echo "Hyperion test execution"
echo
exec_test "hyperiond is executable and show version" bin/hyperiond --version
for cfg in ../config/*json.default
for cfg in ../settings/*json.default
do
exec_test "test $(basename $cfg)" bin/test_configfile $cfg
done