From 39a22deb6a232356bf7b2ef8386679bc8ea2f697 Mon Sep 17 00:00:00 2001 From: vnugent Date: Fri, 10 Nov 2023 22:40:35 -0500 Subject: much needed QOL updates --- back-end/src/Storage/ManagedStorage.cs | 14 ++++++++++++-- 1 file changed, 12 insertions(+), 2 deletions(-) (limited to 'back-end/src/Storage') 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()) + //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(storageAssembly); + } + else if (plugin.HasConfigForType()) { //Use minio storage _backingStorage = plugin.GetOrCreateSingleton(); -- cgit