diff --git a/extra/admin-api/ConfigTest/ConfigTest.csproj b/extra/admin-api/ConfigTest/ConfigTest.csproj
new file mode 100644
index 00000000..7244b673
--- /dev/null
+++ b/extra/admin-api/ConfigTest/ConfigTest.csproj
@@ -0,0 +1,20 @@
+<Project Sdk="Microsoft.NET.Sdk.Worker">
+
+ <PropertyGroup>
+ <TargetFramework>net10.0</TargetFramework>
+ <Nullable>enable</Nullable>
+ <ImplicitUsings>enable</ImplicitUsings>
+ <UserSecretsId>dotnet-ConfigTest-18d89c0e-df5d-447b-8429-7d526a35ab13</UserSecretsId>
+ </PropertyGroup>
+
+ <ItemGroup>
+ <PackageReference Include="Microsoft.EntityFrameworkCore" Version="10.0.1" />
+ <PackageReference Include="Microsoft.Extensions.Hosting" Version="10.0.0" />
+ <PackageReference Include="Npgsql.EntityFrameworkCore.PostgreSQL" Version="10.0.0" />
+ </ItemGroup>
+
+ <ItemGroup>
+ <ProjectReference Include="..\Spacebar.ConfigModel\Spacebar.ConfigModel.csproj" />
+ <ProjectReference Include="..\Spacebar.Db\Spacebar.Db.csproj" />
+ </ItemGroup>
+</Project>
diff --git a/extra/admin-api/ConfigTest/Program.cs b/extra/admin-api/ConfigTest/Program.cs
new file mode 100644
index 00000000..5945bcf6
--- /dev/null
+++ b/extra/admin-api/ConfigTest/Program.cs
@@ -0,0 +1,14 @@
+using ConfigTest;
+using Microsoft.EntityFrameworkCore;
+using Spacebar.Db.Contexts;
+
+var builder = Host.CreateApplicationBuilder(args);
+builder.Services.AddHostedService<Worker>();
+builder.Services.AddDbContext<SpacebarDbContext>(options => {
+ options
+ .UseNpgsql(builder.Configuration.GetConnectionString("Spacebar"))
+ .EnableDetailedErrors();
+}, ServiceLifetime.Singleton);
+
+var host = builder.Build();
+host.Run();
diff --git a/extra/admin-api/ConfigTest/Properties/launchSettings.json b/extra/admin-api/ConfigTest/Properties/launchSettings.json
new file mode 100644
index 00000000..c355f360
--- /dev/null
+++ b/extra/admin-api/ConfigTest/Properties/launchSettings.json
@@ -0,0 +1,12 @@
+{
+ "$schema": "https://json.schemastore.org/launchsettings.json",
+ "profiles": {
+ "ConfigTest": {
+ "commandName": "Project",
+ "dotnetRunMessages": true,
+ "environmentVariables": {
+ "DOTNET_ENVIRONMENT": "Development"
+ }
+ }
+ }
+}
diff --git a/extra/admin-api/ConfigTest/Worker.cs b/extra/admin-api/ConfigTest/Worker.cs
new file mode 100644
index 00000000..dd3ef779
--- /dev/null
+++ b/extra/admin-api/ConfigTest/Worker.cs
@@ -0,0 +1,43 @@
+using System.Text.Json.Nodes;
+using Spacebar.ConfigModel.Extensions;
+using Spacebar.Db.Contexts;
+
+namespace ConfigTest;
+
+public class Worker(ILogger<Worker> logger, SpacebarDbContext db) : BackgroundService
+{
+ protected override async Task ExecuteAsync(CancellationToken stoppingToken)
+ {
+ var config = db.Configs
+ .OrderBy(x => x.Key)
+ .ToDictionary(x => x.Key, x => x.Value);
+ foreach (var (key, value) in config)
+ {
+ Console.WriteLine("Config Key: {0}, Value: {1}", key, value ?? "[NULL]");
+ }
+
+ var readConfig = config.ToNestedJsonObject();
+ Console.WriteLine(readConfig);
+ var mapped = readConfig.ToFlatKv();
+ foreach (var (key, value) in mapped)
+ {
+ Console.WriteLine("Mapped Key: {0}, Value: {1}", key, value ?? "[NULL]");
+ }
+
+ // check that they're equal
+ foreach (var (key, value) in config)
+ {
+ if (!mapped.ContainsKey(key))
+ {
+ Console.WriteLine("Missing Key in Mapped: {0}", key);
+ continue;
+ }
+
+ if (mapped[key] != value)
+ {
+ Console.WriteLine("Value Mismatch for Key: {0}, Original: {1}, Mapped: {2}", key, value ?? "[NULL]", mapped[key] ?? "[NULL]");
+ }
+ }
+ Environment.Exit(0);
+ }
+}
\ No newline at end of file
diff --git a/extra/admin-api/ConfigTest/appsettings.Development.json b/extra/admin-api/ConfigTest/appsettings.Development.json
new file mode 100644
index 00000000..03245773
--- /dev/null
+++ b/extra/admin-api/ConfigTest/appsettings.Development.json
@@ -0,0 +1,27 @@
+{
+ "Logging": {
+ "LogLevel": {
+ "Default": "Information",
+ "Microsoft.AspNetCore": "Trace", //Warning
+ "Microsoft.AspNetCore.Mvc": "Warning", //Warning
+ "Microsoft.AspNetCore.HostFiltering": "Warning", //Warning
+ "Microsoft.AspNetCore.Cors": "Warning", //Warning
+ // "Microsoft.EntityFrameworkCore": "Warning"
+ "Microsoft.EntityFrameworkCore.Database.Command": "Debug"
+ }
+ },
+ "ConnectionStrings": {
+ "Spacebar": "Host=127.0.0.1; Username=postgres; Database=spacebar; Port=5432; Include Error Detail=true; Maximum Pool Size=1000; Command Timeout=6000; Timeout=600;",
+ },
+ "RabbitMQ": {
+ "Host": "127.0.0.1",
+ "Port": 5673,
+ "Username": "guest",
+ "Password": "guest"
+ },
+ "SpacebarAdminApi": {
+ "Enforce2FA": true,
+ "OverrideUid": null,
+ "DisableAuthentication": false
+ }
+}
diff --git a/extra/admin-api/ConfigTest/appsettings.json b/extra/admin-api/ConfigTest/appsettings.json
new file mode 100644
index 00000000..10f68b8c
--- /dev/null
+++ b/extra/admin-api/ConfigTest/appsettings.json
@@ -0,0 +1,9 @@
+{
+ "Logging": {
+ "LogLevel": {
+ "Default": "Information",
+ "Microsoft.AspNetCore": "Warning"
+ }
+ },
+ "AllowedHosts": "*"
+}
|