From 100e782d9cccb21b1b8bc13a25b4fff83ede278c Mon Sep 17 00:00:00 2001 From: Ryan Peters Date: Tue, 23 Jan 2024 11:23:05 -0500 Subject: [PATCH] use connection strings for redis --- BinaryDad.Coding/Properties/launchSettings.json | 8 +------- BinaryDad.Coding/Startup.cs | 4 +++- BinaryDad.Coding/appsettings.Development.json | 3 +++ BinaryDad.Coding/appsettings.json | 5 ++++- 4 files changed, 11 insertions(+), 9 deletions(-) diff --git a/BinaryDad.Coding/Properties/launchSettings.json b/BinaryDad.Coding/Properties/launchSettings.json index 2906a65..3c3e623 100644 --- a/BinaryDad.Coding/Properties/launchSettings.json +++ b/BinaryDad.Coding/Properties/launchSettings.json @@ -8,16 +8,10 @@ } }, "profiles": { - "IIS Express": { - "commandName": "IISExpress", - "launchBrowser": true, - "environmentVariables": { - "ASPNETCORE_ENVIRONMENT": "Development" - } - }, "BinaryDad.Coding": { "commandName": "Project", "launchBrowser": true, + "hotReloadEnabled": false, "environmentVariables": { "ASPNETCORE_ENVIRONMENT": "Development" }, diff --git a/BinaryDad.Coding/Startup.cs b/BinaryDad.Coding/Startup.cs index 1cc39b2..7fdd26e 100644 --- a/BinaryDad.Coding/Startup.cs +++ b/BinaryDad.Coding/Startup.cs @@ -32,8 +32,10 @@ namespace BinaryDad.Coding { AbortOnConnectFail = false }; - config.EndPoints.Add("redis:6379"); + + config.EndPoints.Add(Configuration.GetConnectionString("Redis")); config.SetDefaultPorts(); + var connection = await ConnectionMultiplexer.ConnectAsync(config, writer); connection.ConnectionFailed += (_, e) => { diff --git a/BinaryDad.Coding/appsettings.Development.json b/BinaryDad.Coding/appsettings.Development.json index 5173757..67f255a 100644 --- a/BinaryDad.Coding/appsettings.Development.json +++ b/BinaryDad.Coding/appsettings.Development.json @@ -6,5 +6,8 @@ "Microsoft": "Warning", "Microsoft.Hosting.Lifetime": "Information" } + }, + "ConnectionStrings": { + "Redis": "cluster.home.lan:6379" } } diff --git a/BinaryDad.Coding/appsettings.json b/BinaryDad.Coding/appsettings.json index d9d9a9b..49f4a54 100644 --- a/BinaryDad.Coding/appsettings.json +++ b/BinaryDad.Coding/appsettings.json @@ -6,5 +6,8 @@ "Microsoft.Hosting.Lifetime": "Information" } }, - "AllowedHosts": "*" + "AllowedHosts": "*", + "ConnectionStrings": { + "Redis": "redis:6379" + } }