mirror of
https://github.com/bitwarden/server.git
synced 2025-07-01 16:12:49 -05:00
[PM-21075] Initial database seeder (#5703)
Adds a database seeder which can be used standalone using a CLI for seeding your local development environment, or used in unit tests to seed complex scenarios. --------- Co-authored-by: Robert Y <rkac@bitwarden.com>
This commit is contained in:
25
util/DbSeederUtility/ServiceCollectionExtension.cs
Normal file
25
util/DbSeederUtility/ServiceCollectionExtension.cs
Normal file
@ -0,0 +1,25 @@
|
||||
using Bit.SharedWeb.Utilities;
|
||||
using Microsoft.AspNetCore.DataProtection;
|
||||
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());
|
||||
services.AddSingleton(globalSettings);
|
||||
|
||||
// Add Data Protection services
|
||||
services.AddDataProtection()
|
||||
.SetApplicationName("Bitwarden");
|
||||
|
||||
services.AddDatabaseRepositories(globalSettings);
|
||||
}
|
||||
}
|
Reference in New Issue
Block a user