1
0
Fork 0
mirror of https://github.com/KingDuckZ/dindexer.git synced 2024-11-29 01:33:46 +00:00

Name backend settings section in yml using the backend name itself.

This commit is contained in:
King_DuckZ 2016-06-02 18:38:40 +02:00
parent 4aceccbf4d
commit 7de71943ad
2 changed files with 7 additions and 7 deletions

View file

@ -1,7 +1,7 @@
%YAML 1.2
---
db_backend_name: postgresql
db_backend_settings:
backend_name: postgresql
postgresql_settings:
username: your_username
password: your_password
dbname: dindexer

View file

@ -33,13 +33,13 @@ namespace dinlib {
try {
auto settings = YAML::LoadFile(path);
if (not settings["db_backend_name"]) {
if (not settings["backend_name"]) {
return false;
}
parOut.backend_name = settings["db_backend_name"].as<std::string>();
if (settings["db_backend_settings"]) {
//parOut.db = settings["db_backend_settings"].as<dindb::Settings>();
auto settings_node = settings["db_backend_settings"];
parOut.backend_name = settings["backend_name"].as<std::string>();
const std::string backend_settings_section = parOut.backend_name + "_settings";
if (settings[backend_settings_section]) {
auto settings_node = settings[backend_settings_section];
parOut.backend_plugin = dindb::BackendPlugin(find_plugin_by_name(parOut.backend_name), &settings_node);
return true;
}