Adds Infrastructure security cryptography service (#43)

* Adds Infrastructure security cryptography service

* Updates GitHub Action script to account for empty Environment values

* Updates section of GitHub Action script

* Fixes order of configuration settings import

* Hardcodes secrets used during integration tests
This commit is contained in:
BinaryAlley authored and GitHub committed 2024-11-06 19:11:03 +02:00
1 parent a71487eb05
commit 09928047d0
12 files changed
+280 -8

No files matched your search

@@ -7,6 +7,7 @@ using Microsoft.EntityFrameworkCore;
using Microsoft.Extensions.Configuration;
using Microsoft.Extensions.DependencyInjection;
using System;
using System.Collections.Generic;
using System.Diagnostics.CodeAnalysis;
using System.Linq;
#endregion
@@ -41,13 +42,16 @@ public class LuminaApiFactory : WebApplicationFactory<Program>, IDisposable
// 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.test.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);
config.AddJsonFile($"appsettings.shared.test.json", optional: true, reloadOnChange: true);
// First add the test values directly
config.AddInMemoryCollection(initialData: new Dictionary<string, string?>
{
["JwtSettings:SecretKey"] = "test-key-thats-at-least-32-chars-long-for-jwt",
["EncryptionSettings:SecretKey"] = "dGVzdC1rZXktdGhhdHMtYXQtbGVhc3QtMzItY2hhcnMtbG9uZy1mb3ItZW5jcnlwdGlvbg==" // base64 encoded test key
});
});
builder.ConfigureServices(services =>
{