mirror of
https://github.com/bitwarden/server.git
synced 2025-06-30 23:52:50 -05:00
Add factory to IGlobalSettings DI singleton (#1163)
It turns out Singleton DI of interfaces does not use the specified instance's Singleton, but just creates its own. This fixes the bug where classes expecting an IGlobalSettings were given an empty GlobaSettings instance
This commit is contained in:
@ -423,7 +423,7 @@ namespace Bit.Core.Utilities
|
||||
var globalSettings = new GlobalSettings();
|
||||
ConfigurationBinder.Bind(configuration.GetSection("GlobalSettings"), globalSettings);
|
||||
services.AddSingleton(s => globalSettings);
|
||||
services.AddSingleton<IGlobalSettings, GlobalSettings>();
|
||||
services.AddSingleton<IGlobalSettings, GlobalSettings>(s => globalSettings);
|
||||
return globalSettings;
|
||||
}
|
||||
|
||||
|
Reference in New Issue
Block a user