From 42ece5379a32425644df7f76bbc5496a6c20f732 Mon Sep 17 00:00:00 2001 From: Luca Date: Wed, 8 May 2024 23:57:28 +0200 Subject: [PATCH] Fix resolver config --- Cron/CronConf.cs | 18 ++++-------------- Cron/Program.cs | 4 ++-- LiveControlGateway/Startup.cs | 2 ++ 3 files changed, 8 insertions(+), 16 deletions(-) diff --git a/Cron/CronConf.cs b/Cron/CronConf.cs index c131edb3..15fbdc7b 100644 --- a/Cron/CronConf.cs +++ b/Cron/CronConf.cs @@ -1,15 +1,5 @@ -namespace OpenShock.Cron; +using OpenShock.ServicesCommon.Config; -public sealed class CronConf -{ - public required string Db { get; init; } - public required RedisConfig Redis { get; init; } - - public class RedisConfig - { - public required string Host { get; init; } - public required string User { get; init; } - public required string Password { get; init; } - public required ushort Port { get; init; } - } -} \ No newline at end of file +namespace OpenShock.Cron; + +public sealed class CronConf : BaseConfig; \ No newline at end of file diff --git a/Cron/Program.cs b/Cron/Program.cs index 55ec03aa..7e0943f1 100644 --- a/Cron/Program.cs +++ b/Cron/Program.cs @@ -60,14 +60,14 @@ #pragma warning restore CS0618 services.AddDbContextPool(builder => { - builder.UseNpgsql(config.Db); + builder.UseNpgsql(config.Db.Conn); builder.EnableSensitiveDataLogging(); builder.EnableDetailedErrors(); }); services.AddDbContextFactory(builder => { - builder.UseNpgsql(config.Db); + builder.UseNpgsql(config.Db.Conn); builder.EnableSensitiveDataLogging(); builder.EnableDetailedErrors(); }); diff --git a/LiveControlGateway/Startup.cs b/LiveControlGateway/Startup.cs index 1d589fd7..0256bf37 100644 --- a/LiveControlGateway/Startup.cs +++ b/LiveControlGateway/Startup.cs @@ -84,6 +84,8 @@ public Startup(IConfiguration configuration) /// public void ConfigureServices(IServiceCollection services) { + services.AddSingleton(_lcgConfig); + // ----------------- DATABASE ----------------- // How do I do this now with EFCore?!