mirror of
https://github.com/bitwarden/server.git
synced 2026-01-31 06:03:12 +08:00
34 lines
1.1 KiB
C#
34 lines
1.1 KiB
C#
using Bit.Core.Entities;
|
|
using Bit.SharedWeb.Utilities;
|
|
using Microsoft.AspNetCore.DataProtection;
|
|
using Microsoft.AspNetCore.Identity;
|
|
using Microsoft.Extensions.DependencyInjection;
|
|
using Microsoft.Extensions.Logging;
|
|
|
|
namespace Bit.DbSeederUtility;
|
|
|
|
public static class ServiceCollectionExtension
|
|
{
|
|
public static void ConfigureServices(ServiceCollection services)
|
|
{
|
|
// Load configuration using the GlobalSettingsFactory
|
|
var globalSettings = GlobalSettingsFactory.GlobalSettings;
|
|
|
|
// Register services
|
|
services.AddLogging(builder =>
|
|
{
|
|
builder.AddConsole();
|
|
builder.SetMinimumLevel(LogLevel.Warning);
|
|
builder.AddFilter("Microsoft.EntityFrameworkCore.Model.Validation", LogLevel.Error);
|
|
});
|
|
services.AddSingleton(globalSettings);
|
|
services.AddSingleton<IPasswordHasher<User>, PasswordHasher<User>>();
|
|
|
|
// Add Data Protection services
|
|
services.AddDataProtection()
|
|
.SetApplicationName("Bitwarden");
|
|
|
|
services.AddDatabaseRepositories(globalSettings);
|
|
}
|
|
}
|