summaryrefslogtreecommitdiffhomepage
path: root/plugin.cpp
diff options
context:
space:
mode:
authorRoland Reichwein <mail@reichwein.it>2020-04-10 15:36:59 +0200
committerRoland Reichwein <mail@reichwein.it>2020-04-10 15:36:59 +0200
commitc0ccf16c69d43a89674640c61d13ec2c02b128d6 (patch)
treeae840bc16f0ddb430bdd68aacef4d7cb2af970d9 /plugin.cpp
parent0d157fb407a35f8afe6d6f0f4c2cc5cd5d5a1933 (diff)
First working plugin: static-files
Diffstat (limited to 'plugin.cpp')
-rw-r--r--plugin.cpp24
1 files changed, 18 insertions, 6 deletions
diff --git a/plugin.cpp b/plugin.cpp
index 8e4182c..db0632d 100644
--- a/plugin.cpp
+++ b/plugin.cpp
@@ -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;
}
}
}