summary refs log tree commit diff
path: root/extra/admin-api/ConfigTest
diff options
context:
space:
mode:
Diffstat (limited to 'extra/admin-api/ConfigTest')
-rw-r--r--extra/admin-api/ConfigTest/ConfigTest.csproj20
-rw-r--r--extra/admin-api/ConfigTest/Program.cs14
-rw-r--r--extra/admin-api/ConfigTest/Properties/launchSettings.json12
-rw-r--r--extra/admin-api/ConfigTest/Worker.cs43
-rw-r--r--extra/admin-api/ConfigTest/appsettings.Development.json27
-rw-r--r--extra/admin-api/ConfigTest/appsettings.json9
6 files changed, 0 insertions, 125 deletions
diff --git a/extra/admin-api/ConfigTest/ConfigTest.csproj b/extra/admin-api/ConfigTest/ConfigTest.csproj
deleted file mode 100644

index 7eea9a8a..00000000 --- a/extra/admin-api/ConfigTest/ConfigTest.csproj +++ /dev/null
@@ -1,20 +0,0 @@ -<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.1" /> - <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 deleted file mode 100644
index 5945bcf6..00000000 --- a/extra/admin-api/ConfigTest/Program.cs +++ /dev/null
@@ -1,14 +0,0 @@ -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 deleted file mode 100644
index c355f360..00000000 --- a/extra/admin-api/ConfigTest/Properties/launchSettings.json +++ /dev/null
@@ -1,12 +0,0 @@ -{ - "$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 deleted file mode 100644
index dd3ef779..00000000 --- a/extra/admin-api/ConfigTest/Worker.cs +++ /dev/null
@@ -1,43 +0,0 @@ -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 deleted file mode 100644
index 03245773..00000000 --- a/extra/admin-api/ConfigTest/appsettings.Development.json +++ /dev/null
@@ -1,27 +0,0 @@ -{ - "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 deleted file mode 100644
index 10f68b8c..00000000 --- a/extra/admin-api/ConfigTest/appsettings.json +++ /dev/null
@@ -1,9 +0,0 @@ -{ - "Logging": { - "LogLevel": { - "Default": "Information", - "Microsoft.AspNetCore": "Warning" - } - }, - "AllowedHosts": "*" -}