Skip to content

Commit

Permalink
Refactor config retrieval and update appsettings.json
Browse files Browse the repository at this point in the history
Simplified the retrieval of the `TopClientTypes` configuration value in `ReportController.cs` by using `int.Parse(configuration["TopClientTypes"]!)` instead of `configuration.GetSection("AppSettings:TopClientTypes").Get<int>()`.

Restructured `appsettings.json` to move `TopClientTypes` and `DefaultRedirectionUrl` settings out of the `AppSettings` section and place them directly at the root level, aligning with the updated code in `ReportController.cs`.
  • Loading branch information
EdiWang committed Aug 18, 2024
1 parent 77fe831 commit 952035b
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 5 deletions.
2 changes: 1 addition & 1 deletion src/API/Controllers/ReportController.cs
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@ public async Task<IActionResult> MostRequestedLinks(DateRangeRequest request)
public async Task<IActionResult> ClientType(DateRangeRequest request)
{
var types = await mediator.Send(new GetClientTypeCountsQuery(request,
configuration.GetSection("AppSettings:TopClientTypes").Get<int>()));
int.Parse(configuration["TopClientTypes"]!)));
return Ok(types);
}

Expand Down
6 changes: 2 additions & 4 deletions src/API/appsettings.json
Original file line number Diff line number Diff line change
Expand Up @@ -27,10 +27,8 @@
"13.86.153.189",
"40.80.156.205"
],
"AppSettings": {
"DefaultRedirectionUrl": "https://edi.wang",
"TopClientTypes": 5
},
"DefaultRedirectionUrl": "https://edi.wang",
"TopClientTypes": 5,
"FeatureManagement": {
"AllowSelfRedirection": false,
"EnableTracking": true
Expand Down

0 comments on commit 952035b

Please sign in to comment.