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";