diff --git a/Wallet/WalletInitializer.cs b/Wallet/WalletInitializer.cs index 90b62fc..d232dc4 100644 --- a/Wallet/WalletInitializer.cs +++ b/Wallet/WalletInitializer.cs @@ -1,18 +1,23 @@ -using Toolkit.Foundation; +using Microsoft.Extensions.Configuration; +using Microsoft.Extensions.Hosting; +using Toolkit.Foundation; namespace Wallet; -public class WalletInitializer(IEnumerable> configurations, +public class WalletInitializer(IHostingEnvironment environment, IEnumerable> configurations, IComponentFactory componentFactory, IWalletHostCollection Wallets) : IInitialization { public async Task Initialize() { - foreach (IConfigurationDescriptor configuration in configurations) + foreach (string wallet in Directory.EnumerateDirectories(Path.Combine(environment.ContentRootPath, "Wallet"))) { + string name = Path.GetFileName(wallet); + string section = $"Wallet:{name}"; + if (componentFactory.Create(configuration.Section, configuration.Value) + WalletConfiguration>(section) is IComponentHost host) { Wallets.Add(host);