From e288af07d14697b04254aa9b640b78a3d749fa15 Mon Sep 17 00:00:00 2001 From: Jay Malhotra Date: Fri, 14 Jun 2024 00:07:04 +0100 Subject: [PATCH] Use IOptionsMonitor to hot reload config --- DragaliaAPI/DragaliaAPI/ServiceConfiguration.cs | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/DragaliaAPI/DragaliaAPI/ServiceConfiguration.cs b/DragaliaAPI/DragaliaAPI/ServiceConfiguration.cs index c5fcf4a34..6fa64b550 100644 --- a/DragaliaAPI/DragaliaAPI/ServiceConfiguration.cs +++ b/DragaliaAPI/DragaliaAPI/ServiceConfiguration.cs @@ -161,8 +161,11 @@ IConfiguration configuration services.AddHttpClient( (sp, client) => { - IOptions options = sp.GetRequiredService>(); - client.BaseAddress = new(options.Value.StateManagerUrl); + IOptionsMonitor options = sp.GetRequiredService< + IOptionsMonitor + >(); + + client.BaseAddress = new(options.CurrentValue.StateManagerUrl); } ); services.AddScoped();