mirror of
https://github.com/bitwarden/server.git
synced 2024-11-22 12:15:36 +01: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:
parent
e350daeeee
commit
73346b01d1
@ -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;
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user