From 3044eb925aa45052931f1a332550388d2843d588 Mon Sep 17 00:00:00 2001 From: Atralupus Date: Fri, 6 Oct 2023 18:44:51 +0900 Subject: [PATCH] Port settings --- .../MutableRedisAccessControlService.cs | 3 +-- .../Configuration.cs | 2 ++ .../Controllers/AccessControlServiceController.cs | 8 ++++++-- NineChronicles.Headless.AccessControlCenter/Program.cs | 2 +- .../appsettings.json | 1 + 5 files changed, 11 insertions(+), 5 deletions(-) diff --git a/NineChronicles.Headless.AccessControlCenter/AccessControlService/MutableRedisAccessControlService.cs b/NineChronicles.Headless.AccessControlCenter/AccessControlService/MutableRedisAccessControlService.cs index c6fbf961d..eec152cd3 100644 --- a/NineChronicles.Headless.AccessControlCenter/AccessControlService/MutableRedisAccessControlService.cs +++ b/NineChronicles.Headless.AccessControlCenter/AccessControlService/MutableRedisAccessControlService.cs @@ -1,6 +1,5 @@ using System.Collections.Generic; using System.Linq; -using StackExchange.Redis; using Libplanet.Crypto; using NineChronicles.Headless.Services; @@ -27,7 +26,7 @@ public List
ListBlockedAddresses(int offset, int limit) { var server = _db.Multiplexer.GetServer(_db.Multiplexer.GetEndPoints().First()); var keys = server - .Keys(database: _db.Database, pattern: "*") + .Keys() .Select(k => new Address(k.ToString())) .ToList(); diff --git a/NineChronicles.Headless.AccessControlCenter/Configuration.cs b/NineChronicles.Headless.AccessControlCenter/Configuration.cs index 6c35c9097..22ca923df 100644 --- a/NineChronicles.Headless.AccessControlCenter/Configuration.cs +++ b/NineChronicles.Headless.AccessControlCenter/Configuration.cs @@ -2,6 +2,8 @@ namespace NineChronicles.Headless.AccessControlCenter { public class Configuration { + public int Port { get; set; } + public string AccessControlServiceType { get; set; } = null!; public string AccessControlServiceConnectionString { get; set; } = null!; diff --git a/NineChronicles.Headless.AccessControlCenter/Controllers/AccessControlServiceController.cs b/NineChronicles.Headless.AccessControlCenter/Controllers/AccessControlServiceController.cs index 84a5a5c2e..685dca35e 100644 --- a/NineChronicles.Headless.AccessControlCenter/Controllers/AccessControlServiceController.cs +++ b/NineChronicles.Headless.AccessControlCenter/Controllers/AccessControlServiceController.cs @@ -1,6 +1,7 @@ using System.Collections.Generic; using Microsoft.AspNetCore.Mvc; using NineChronicles.Headless.AccessControlCenter.AccessControlService; +using System.Linq; using Libplanet.Crypto; namespace NineChronicles.Headless.AccessControlCenter.Controllers @@ -36,9 +37,12 @@ public ActionResult AllowAccess(string address) } [HttpGet("entries")] - public ActionResult> ListBlockedAddresses(int offset, int limit) + public ActionResult> ListBlockedAddresses(int offset, int limit) { - return _accessControlService.ListBlockedAddresses(offset, limit); + return _accessControlService + .ListBlockedAddresses(offset, limit) + .Select(a => a.ToString()) + .ToList(); } } } diff --git a/NineChronicles.Headless.AccessControlCenter/Program.cs b/NineChronicles.Headless.AccessControlCenter/Program.cs index edf0377e0..a48cd2312 100644 --- a/NineChronicles.Headless.AccessControlCenter/Program.cs +++ b/NineChronicles.Headless.AccessControlCenter/Program.cs @@ -24,7 +24,7 @@ public static void Main(string[] args) acsConfig.AccessControlServiceType, acsConfig.AccessControlServiceConnectionString ); - var hostBuilder = service.Configure(Host.CreateDefaultBuilder(), 31259); + var hostBuilder = service.Configure(Host.CreateDefaultBuilder(), acsConfig.Port); var host = hostBuilder.Build(); host.Run(); } diff --git a/NineChronicles.Headless.AccessControlCenter/appsettings.json b/NineChronicles.Headless.AccessControlCenter/appsettings.json index 3f6c4bb37..fbf1f5da2 100644 --- a/NineChronicles.Headless.AccessControlCenter/appsettings.json +++ b/NineChronicles.Headless.AccessControlCenter/appsettings.json @@ -1,4 +1,5 @@ { + "Port": "31259", "AccessControlServiceType": "redis", "AccessControlServiceConnectionString": "localhost:6379" }