mirror of
https://github.com/bitwarden/server.git
synced 2024-12-10 15:13:29 +01:00
aa34bbb0e6
* Add Collections Tests * Update CollectionRepository Implementation * Test Adding And Deleting Through Replace * Format * Fix Most Test Warnings * Format
32 lines
773 B
C#
32 lines
773 B
C#
using Bit.Core.Enums;
|
|
using Microsoft.Extensions.Configuration;
|
|
|
|
namespace Bit.Infrastructure.IntegrationTest;
|
|
|
|
public class Database
|
|
{
|
|
public SupportedDatabaseProviders Type { get; set; }
|
|
public string ConnectionString { get; set; } = default!;
|
|
public bool UseEf { get; set; }
|
|
public bool Enabled { get; set; } = true;
|
|
}
|
|
|
|
internal class TypedConfig
|
|
{
|
|
public Database[] Databases { get; set; } = default!;
|
|
}
|
|
|
|
public static class ConfigurationExtensions
|
|
{
|
|
public static Database[] GetDatabases(this IConfiguration config)
|
|
{
|
|
var typedConfig = config.Get<TypedConfig>();
|
|
if (typedConfig?.Databases == null)
|
|
{
|
|
return [];
|
|
}
|
|
|
|
return typedConfig.Databases.Where(d => d.Enabled).ToArray();
|
|
}
|
|
}
|