diff options
author | vnugent <public@vaughnnugent.com> | 2023-11-10 22:40:35 -0500 |
---|---|---|
committer | vnugent <public@vaughnnugent.com> | 2023-11-10 22:40:35 -0500 |
commit | 39a22deb6a232356bf7b2ef8386679bc8ea2f697 (patch) | |
tree | 743eb0a0bb06a8ae85a36778c748880374798f01 /back-end/src/Storage | |
parent | 00582bef545a912c2f81ea359dc00c92dd991ceb (diff) |
much needed QOL updates
Diffstat (limited to 'back-end/src/Storage')
-rw-r--r-- | back-end/src/Storage/ManagedStorage.cs | 14 |
1 files changed, 12 insertions, 2 deletions
diff --git a/back-end/src/Storage/ManagedStorage.cs b/back-end/src/Storage/ManagedStorage.cs index 19e208c..66e9a4a 100644 --- a/back-end/src/Storage/ManagedStorage.cs +++ b/back-end/src/Storage/ManagedStorage.cs @@ -30,13 +30,23 @@ using VNLib.Plugins.Extensions.Loading; namespace Content.Publishing.Blog.Admin.Storage { + [ConfigurationName("storage", Required = false)] internal sealed class ManagedStorage : ISimpleFilesystem { private readonly ISimpleFilesystem _backingStorage; - public ManagedStorage(PluginBase plugin) + public ManagedStorage(PluginBase plugin) : this(plugin, null) + { } + + public ManagedStorage(PluginBase plugin, IConfigScope? config) { - if (plugin.HasConfigForType<MinioClientManager>()) + //try to get custom storage assembly + if (config != null && config.ContainsKey("custom_storage_assembly")) + { + string storageAssembly = config.GetRequiredProperty("custom_storage_assembly", p => p.GetString()!); + _backingStorage = plugin.CreateServiceExternal<ISimpleFilesystem>(storageAssembly); + } + else if (plugin.HasConfigForType<MinioClientManager>()) { //Use minio storage _backingStorage = plugin.GetOrCreateSingleton<MinioClientManager>(); |