Core: finalize plugin services after discovery
This commit is contained in:
1 parent
dfbbdaaf01
commit
a277f2102b
3 files changed
+15
-9
No files matched your search
@@ -47,6 +47,9 @@ namespace Echoion::Core
|
|||||||
|
|
||||||
void loadDirectory(const std::filesystem::path& directory);
|
void loadDirectory(const std::filesystem::path& directory);
|
||||||
void loadManagedDirectory(const std::filesystem::path& directory);
|
void loadManagedDirectory(const std::filesystem::path& directory);
|
||||||
|
// Bind and validate cross-plugin services after every startup
|
||||||
|
// directory has been loaded.
|
||||||
|
[[nodiscard]] bool finalizeLoading();
|
||||||
[[nodiscard]] Api::Result<std::string>
|
[[nodiscard]] Api::Result<std::string>
|
||||||
manage(const std::string& requestJson);
|
manage(const std::string& requestJson);
|
||||||
void setChangeCallback(std::function<void()> callback);
|
void setChangeCallback(std::function<void()> callback);
|
||||||
|
|||||||
@@ -469,6 +469,7 @@ namespace Echoion::Core
|
|||||||
extensionPlugins_->loadDirectory(stateDir / "plugins");
|
extensionPlugins_->loadDirectory(stateDir / "plugins");
|
||||||
extensionPlugins_->loadManagedDirectory(stateDir / "plugins" /
|
extensionPlugins_->loadManagedDirectory(stateDir / "plugins" /
|
||||||
".managed");
|
".managed");
|
||||||
|
(void)extensionPlugins_->finalizeLoading();
|
||||||
applyUrlShorteningConfig();
|
applyUrlShorteningConfig();
|
||||||
|
|
||||||
#ifdef ECHOION_WITH_WEB
|
#ifdef ECHOION_WITH_WEB
|
||||||
|
|||||||
+11
-9
@@ -317,11 +317,6 @@ namespace Echoion::Core
|
|||||||
publish(*result);
|
publish(*result);
|
||||||
plugins_.watch(*result);
|
plugins_.watch(*result);
|
||||||
}
|
}
|
||||||
if (!bindShortenerServices()) {
|
|
||||||
Void::Log::warn("PluginHost",
|
|
||||||
"Loaded plugins do not provide the configured "
|
|
||||||
"short URL service");
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void
|
void
|
||||||
@@ -378,11 +373,18 @@ namespace Echoion::Core
|
|||||||
publish(id);
|
publish(id);
|
||||||
plugins_.watch(id);
|
plugins_.watch(id);
|
||||||
}
|
}
|
||||||
if (!bindShortenerServices()) {
|
}
|
||||||
Void::Log::warn("PluginHost",
|
|
||||||
"Managed plugins do not provide the configured "
|
bool PluginHost::finalizeLoading()
|
||||||
"short URL service");
|
{
|
||||||
|
std::scoped_lock operationLock{reconfigureMutex_};
|
||||||
|
if (bindShortenerServices()) {
|
||||||
|
return true;
|
||||||
}
|
}
|
||||||
|
Void::Log::warn("PluginHost",
|
||||||
|
"Loaded plugins do not provide the configured short "
|
||||||
|
"URL service");
|
||||||
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
std::string PluginHost::pluginConfiguration(std::string_view name) const
|
std::string PluginHost::pluginConfiguration(std::string_view name) const
|
||||||
|
|||||||
Reference in new issue
Block a user