-
Notifications
You must be signed in to change notification settings - Fork 3
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
cf3344f
commit 7fe32c6
Showing
7 changed files
with
125 additions
and
27 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
15 changes: 15 additions & 0 deletions
15
PiBox.Hosting/WebHost/src/PiBox.Hosting.WebHost/Extensions/ConfigurationManagerExtensions.cs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,15 @@ | ||
using Microsoft.Extensions.Configuration; | ||
|
||
namespace PiBox.Hosting.WebHost.Extensions | ||
{ | ||
internal static class ConfigurationManagerExtensions | ||
{ | ||
public static void AddFile(this ConfigurationManager configurationManager, string file, bool optional = true, bool reloadOnChange = true) | ||
{ | ||
if (file.EndsWith(".json")) | ||
configurationManager.AddJsonFile(file, optional, reloadOnChange); | ||
else if (file.EndsWith(".yaml") || file.EndsWith(".yml")) | ||
configurationManager.AddYamlFile(file, optional, reloadOnChange); | ||
} | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
5 changes: 5 additions & 0 deletions
5
PiBox.Hosting/WebHost/test/PiBox.Hosting.WebHost.Tests/appsettings.test.secrets.json
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
{ | ||
"serilog": { | ||
"minimumLevel": "Information" | ||
} | ||
} |
53 changes: 53 additions & 0 deletions
53
PiBox.Hosting/WebHost/test/PiBox.Hosting.WebHost.Tests/appsettings.test.yml
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,53 @@ | ||
IpRateLimiting: | ||
EnableEndpointRateLimiting: false | ||
StackBlockedRequests: false | ||
RealIpHeader: X-Real-IP | ||
ClientIdHeader: X-ClientId | ||
HttpStatusCode: 429 | ||
IpWhitelist: | ||
- 127.0.0.1 | ||
- "::1/10" | ||
- 192.168.0.0/24 | ||
EndpointWhitelist: | ||
- get:/api/license | ||
- "*:/api/status" | ||
ClientWhitelist: | ||
- dev-id-1 | ||
- dev-id-2 | ||
GeneralRules: | ||
- Endpoint: "*" | ||
Period: 1s | ||
Limit: 2 | ||
- Endpoint: "*" | ||
Period: 15m | ||
Limit: 100 | ||
- Endpoint: "*" | ||
Period: 12h | ||
Limit: 1000 | ||
- Endpoint: "*" | ||
Period: 7d | ||
Limit: 10000 | ||
|
||
IpRateLimitPolicies: | ||
IpRules: | ||
- Ip: 84.247.85.224 | ||
Rules: | ||
- Endpoint: "*" | ||
Period: 1s | ||
Limit: 10 | ||
- Ip: 192.168.3.22/25 | ||
Rules: | ||
- Endpoint: "*" | ||
Period: 12h | ||
Limit: 500 | ||
|
||
CorsPolicy: | ||
Origins: | ||
- "http://localhost:4200" | ||
- "http://localhost:4201" | ||
Methods: | ||
- "POST" | ||
SupportsCredentials: "true" | ||
|
||
sampleConfig: | ||
name: example1 |