mirror of
https://github.com/BinaryAlley/Nemera.git
synced 2026-12-03 19:21:10 +00:00
Merge pull request #50 from BinaryAlley/refactor/update-github-action-script-with-environemnt-variables
Integrates environment variables into integration tests project
This commit is contained in:
1 file changed
+14
+14
@@ -4,6 +4,7 @@ using Microsoft.AspNetCore.Hosting;
|
|||||||
using Microsoft.AspNetCore.Mvc.Testing;
|
using Microsoft.AspNetCore.Mvc.Testing;
|
||||||
using Microsoft.Data.Sqlite;
|
using Microsoft.Data.Sqlite;
|
||||||
using Microsoft.EntityFrameworkCore;
|
using Microsoft.EntityFrameworkCore;
|
||||||
|
using Microsoft.Extensions.Configuration;
|
||||||
using Microsoft.Extensions.DependencyInjection;
|
using Microsoft.Extensions.DependencyInjection;
|
||||||
using System;
|
using System;
|
||||||
using System.Diagnostics.CodeAnalysis;
|
using System.Diagnostics.CodeAnalysis;
|
||||||
@@ -35,6 +36,19 @@ public class LuminaApiFactory : WebApplicationFactory<Program>, IDisposable
|
|||||||
/// <param name="builder">The web host builder to configure.</param>
|
/// <param name="builder">The web host builder to configure.</param>
|
||||||
protected override void ConfigureWebHost(IWebHostBuilder builder)
|
protected override void ConfigureWebHost(IWebHostBuilder builder)
|
||||||
{
|
{
|
||||||
|
builder.ConfigureAppConfiguration((context, config) =>
|
||||||
|
{
|
||||||
|
// clear all existing configuration sources
|
||||||
|
config.Sources.Clear();
|
||||||
|
|
||||||
|
// add environment variables coming from CI secrets
|
||||||
|
config.AddEnvironmentVariables();
|
||||||
|
|
||||||
|
config.AddJsonFile("appsettings.json", optional: true, reloadOnChange: true);
|
||||||
|
config.AddJsonFile($"appsettings.{context.HostingEnvironment.EnvironmentName}.json", optional: true, reloadOnChange: true);
|
||||||
|
config.AddJsonFile("appsettings.shared.json", optional: true, reloadOnChange: true);
|
||||||
|
config.AddJsonFile($"appsettings.shared.{context.HostingEnvironment.EnvironmentName}.json", optional: true, reloadOnChange: true);
|
||||||
|
});
|
||||||
builder.ConfigureServices(services =>
|
builder.ConfigureServices(services =>
|
||||||
{
|
{
|
||||||
// remove existing DbContext configuration
|
// remove existing DbContext configuration
|
||||||
|
|||||||
Reference in new issue
Block a user