diff options
author | Roland Reichwein <mail@reichwein.it> | 2020-04-10 15:36:59 +0200 |
---|---|---|
committer | Roland Reichwein <mail@reichwein.it> | 2020-04-10 15:36:59 +0200 |
commit | c0ccf16c69d43a89674640c61d13ec2c02b128d6 (patch) | |
tree | ae840bc16f0ddb430bdd68aacef4d7cb2af970d9 /plugin.cpp | |
parent | 0d157fb407a35f8afe6d6f0f4c2cc5cd5d5a1933 (diff) |
First working plugin: static-files
Diffstat (limited to 'plugin.cpp')
-rw-r--r-- | plugin.cpp | 24 |
1 files changed, 18 insertions, 6 deletions
@@ -60,13 +60,25 @@ bool PluginLoader::validate_config() for (const auto& site: sites) { for (const auto& path: site.paths) { - if (path.type == Plugin) { - std::string plugin {path.params.at("plugin")}; + // path must contain target and plugin + auto it {path.params.find("target")}; + if (it == path.params.end()) { + std::cout << "Path " << path.requested << " for site " << site.name << " is missing target specification." << std::endl; + return false; + } - if (!m_plugins.contains(plugin)) { - std::cout << "Configured plugin " << plugin << " not found" << std::endl; - return false; - } + it = path.params.find("plugin"); + if (it == path.params.end()) { + std::cout << "Path " << path.requested << " for site " << site.name << " is missing plugin specification." << std::endl; + return false; + } + + std::string plugin {it->second}; + + // check if plugin exists + if (!m_plugins.contains(plugin)) { + std::cout << "Configured plugin " << plugin << " not found" << std::endl; + return false; } } } |