Skip to content

Commit

Permalink
Use IOptionsMonitor to hot reload config
Browse files Browse the repository at this point in the history
  • Loading branch information
SapiensAnatis committed Jun 13, 2024
1 parent c6317de commit e288af0
Showing 1 changed file with 5 additions and 2 deletions.
7 changes: 5 additions & 2 deletions DragaliaAPI/DragaliaAPI/ServiceConfiguration.cs
Original file line number Diff line number Diff line change
Expand Up @@ -161,8 +161,11 @@ IConfiguration configuration
services.AddHttpClient<IPhotonStateApi, PhotonStateApi>(
(sp, client) =>
{
IOptions<PhotonOptions> options = sp.GetRequiredService<IOptions<PhotonOptions>>();
client.BaseAddress = new(options.Value.StateManagerUrl);
IOptionsMonitor<PhotonOptions> options = sp.GetRequiredService<
IOptionsMonitor<PhotonOptions>
>();
client.BaseAddress = new(options.CurrentValue.StateManagerUrl);
}
);
services.AddScoped<IMatchingService, MatchingService>();
Expand Down

0 comments on commit e288af0

Please sign in to comment.