From 2a04631b5e75915e4ec54f367987c89c1b8b5c27 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=EA=B9=80=ED=8C=90=EB=8F=8C?= Date: Sat, 6 Apr 2024 20:18:26 +0900 Subject: [PATCH] =?UTF-8?q?redis=20=EB=B2=84=EA=B7=B8=20=EC=88=98=EC=A0=95?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- Server/System/Redis.cs | 21 ++++++++++++++++++--- Server/System/Statics.cs | 4 ++-- 2 files changed, 20 insertions(+), 5 deletions(-) diff --git a/Server/System/Redis.cs b/Server/System/Redis.cs index 4c1a19d..a43fd06 100644 --- a/Server/System/Redis.cs +++ b/Server/System/Redis.cs @@ -15,7 +15,7 @@ namespace Server.System Dictionary> listType; Dictionary> zType; Dictionary> hashType; - public Redis(string host = "127.0.0.1", int port = 6379, int db = 0) + public Redis(string host = "127.0.0.1", int port = 6379, int db = 0, string password = "") { if (host == "localhost") { @@ -27,8 +27,23 @@ namespace Server.System } else { - redis = ConnectionMultiplexer.Connect($"{host}:{port}"); - this.db = redis.GetDatabase(db); + if (password.Equals(string.Empty)) + { + Console.WriteLine("true"); + redis = ConnectionMultiplexer.Connect($"{host}:{port}"); + this.db = redis.GetDatabase(db); + } + else + { + Console.WriteLine("true"); + ConfigurationOptions options = new ConfigurationOptions + { + EndPoints = { $"{host}:{port}" }, + Password = password + }; + redis = ConnectionMultiplexer.Connect(options); + this.db = redis.GetDatabase(db); + } } } diff --git a/Server/System/Statics.cs b/Server/System/Statics.cs index 622f220..ab3cc52 100644 --- a/Server/System/Statics.cs +++ b/Server/System/Statics.cs @@ -10,12 +10,12 @@ namespace Server.System public static readonly string SQL_URL = "Host=192.168.0.2;Port=5432;Username=manager;Password=Zn2zs558W5SdD8K;Database=project_thewar;"; public static readonly string EXCEL_SQL_URL = "Host=192.168.0.2;Port=5432;Username=manager;Password=Zn2zs558W5SdD8K;Database=project_thewar;"; public static readonly string remoteUrl = "https://manager:BQNl01bJJF0wn9R@gitea.pandoli365.com/Team.thewar/thewar_excel.git"; - public static readonly Redis redis = new Redis("192.168.1.2", 6379, 1); + public static readonly Redis redis = new Redis("192.168.1.2", 6379, 1, "xPEz3x08xQ8G1Fa"); #elif LIVE public static readonly string SQL_URL = "Host=192.168.0.2;Port=5432;Username=manager;Password=Zn2zs558W5SdD8K;Database=project_thewar;"; public static readonly string EXCEL_SQL_URL = "Host=192.168.0.2;Port=5432;Username=manager;Password=Zn2zs558W5SdD8K;Database=project_thewar;"; public static readonly string remoteUrl = "https://manager:BQNl01bJJF0wn9R@gitea.pandoli365.com/Team.thewar/thewar_excel_live.git"; - public static readonly Redis redis = new Redis("192.168.1.2", 6379, 1); + public static readonly Redis redis = new Redis("192.168.1.2", 6379, 1, "xPEz3x08xQ8G1Fa"); #endif public static readonly string URL = "https://0.0.0.0:4860";