Skip to content

Commit a3105f0

Browse files
committed
minor changes
1 parent efa6c64 commit a3105f0

File tree

1 file changed

+7
-2
lines changed

1 file changed

+7
-2
lines changed

RateLimiter/Rules/GeoBasedRule.cs

+7-2
Original file line numberDiff line numberDiff line change
@@ -18,8 +18,7 @@ public class GeoBasedRule(IDistributedCache cache,
1818

1919
public async Task<bool> EvaluateAsync(HttpContext httpContext)
2020
{
21-
// get from token or resolve by ip
22-
string country = Country.EU;
21+
string country = ResolveCountry();
2322
if (!_configs.TryGetValue(country, out var config))
2423
{
2524
// no limit for current country, so skip it
@@ -46,5 +45,11 @@ public async Task<bool> EvaluateAsync(HttpContext httpContext)
4645
await _cache.SetStringAsync(cacheKey, JsonSerializer.Serialize(0), options);
4746
return true;
4847
}
48+
49+
private string ResolveCountry()
50+
{
51+
// get from token or resolve by ip
52+
return Country.EU;
53+
}
4954
}
5055
}

0 commit comments

Comments
 (0)