Template
chore: deploy initial code base
This commit is contained in:
+46
@@ -0,0 +1,46 @@
|
||||
using Microsoft.EntityFrameworkCore;
|
||||
using Microsoft.Extensions.DependencyInjection;
|
||||
using Strata.ApiLib.Core.Cors.Extensions;
|
||||
using Strata.ApiLib.Core.StrataAuthentication.Bootstrappers;
|
||||
using Strata.Configuration.Client.DependencyInjection.ConsoleApps;
|
||||
using Strata.ContinuousImprovement.Biz.Configurations;
|
||||
using Strata.ContinuousImprovement.Biz.DbContexts;
|
||||
using System.Diagnostics.CodeAnalysis;
|
||||
|
||||
namespace Strata.ContinuousImprovement.Api.Test.Integration.Setup
|
||||
{
|
||||
[ExcludeFromCodeCoverage]
|
||||
public static class ServiceCollectionFactory
|
||||
{
|
||||
// dev master
|
||||
private static readonly Guid DatabaseGuid = new("54409f55-5ddf-4748-8222-9ccfb04fb4f5");
|
||||
private static readonly string IntegrationTesting = $"ci_api_{DateTime.Now:yyyyMMdd}_{Guid.NewGuid():N}";
|
||||
|
||||
public static IServiceCollection Create()
|
||||
{
|
||||
var services = new ServiceCollection();
|
||||
try
|
||||
{
|
||||
var configuration = StrataConfigurationFactory.GetConfiguration();
|
||||
services.AddSingleton(configuration);
|
||||
services.AddStrataAuthentication(configuration);
|
||||
services.AddStrataCors(configuration);
|
||||
services.AddContinuousImprovementServices(configuration, IntegrationTesting);
|
||||
services.AddAsyncDbContextFactory<JazzDbContext>(options =>
|
||||
{
|
||||
options
|
||||
.WithConnectionString((provider, token) => provider.GetConnectionStringFromSmc(DatabaseGuid, token))
|
||||
.WithDbContextOptions((connectionString, provider, builder) =>
|
||||
builder.UseSqlServer(connectionString, options => { options.CommandTimeout(300); }));
|
||||
});
|
||||
services.AddLogging();
|
||||
}
|
||||
catch (Exception)
|
||||
{
|
||||
throw;
|
||||
}
|
||||
|
||||
return services;
|
||||
}
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user