Skip to content

Commit 9659a08

Browse files
committed
Change serilog builder package
1 parent edd8bb2 commit 9659a08

File tree

5 files changed

+270
-8
lines changed

5 files changed

+270
-8
lines changed

AspNetScaffolding3.DemoApi/appsettings.json

Lines changed: 10 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -90,7 +90,7 @@
9090
"JsonBlacklistRequest": [ "*password", "*card.number", "*creditcardnumber", "*cvv", "*only_request" ],
9191
"JsonBlacklistResponse": [ "*password", "*card.number", "*creditcardnumber", "*cvv", "*only_response" ],
9292
"SeqOptions": {
93-
"Enabled": true,
93+
"Enabled": false,
9494
"MinimumLevel": "Verbose",
9595
"Url": "http://localhost:5341",
9696
"ApiKey": "XXXX"
@@ -111,6 +111,15 @@
111111
"Company": "MyCompany",
112112
"ProductVersion": "1.0.0",
113113
"SourceType": "_json"
114+
},
115+
"DataDogOptions": {
116+
"Enabled": true,
117+
"MinimumLevel": "Verbose",
118+
"ApiKey": "ca0b9f4c28905afdaf60758baac0e2db",
119+
"Service": null,
120+
"Source": null,
121+
"Host": null,
122+
"Tags": []
114123
}
115124
},
116125
"DocsSettings": {

AspNetScaffolding3/AspNetScaffolding3.csproj

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -56,7 +56,7 @@
5656
<PackageReference Include="RedLock.net" Version="2.3.1" />
5757
<PackageReference Include="RestSharp.Easy" Version="1.5.1-preview.3" />
5858
<PackageReference Include="RestSharp.Serilog.Auto" Version="1.3.0" />
59-
<PackageReference Include="Serilog.Builder" Version="1.4.0-preview.1" />
59+
<PackageReference Include="Serilog.Builder" Version="1.4.1-preview.9" />
6060
<PackageReference Include="SqlClient.ParseToObject" Version="1.1.0" />
6161
<PackageReference Include="Swashbuckle.AspNetCore" Version="5.5.1" />
6262
<PackageReference Include="Swashbuckle.AspNetCore.Newtonsoft" Version="5.5.1" />

AspNetScaffolding3/appsettings.json

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -82,7 +82,7 @@
8282
"LogSettings": {
8383
"DebugEnabled": true,
8484
"TitlePrefix": "[{Application}] ",
85-
"JsonBlacklistRequest": [ "*password", "*card.number", "*creditcardnumber", "*cvv" ],
85+
"JsonBlacklistRequest": [ "*password", "*card.number", "*creditcardnumber", "*cvv" ],
8686
"JsonBlacklistResponse": [ "*password", "*card.number", "*creditcardnumber", "*cvv" ],
8787
"IgnoredRoutes": [],
8888
"SeqOptions": {
@@ -111,10 +111,10 @@
111111
"DataDogOptions": {
112112
"Enabled": false,
113113
"MinimumLevel": "Verbose",
114-
"ApiKey": "XXXX",
115-
"Service": "",
116-
"Source": "",
117-
"Host": "",
114+
"ApiKey": "XXX",
115+
"Service": null,
116+
"Source": null,
117+
"Host": null,
118118
"Tags": []
119119
}
120120
},

README.md

Lines changed: 10 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -179,7 +179,7 @@ App Settings
179179
"JsonBlacklistRequest": [ "*password", "*card.number", "*creditcardnumber", "*cvv" ],
180180
"JsonBlacklistResponse": [ "*password", "*card.number", "*creditcardnumber", "*cvv" ],
181181
"SeqOptions": {
182-
"Enabled": true,
182+
"Enabled": false,
183183
"MinimumLevel": "Verbose",
184184
"Url": "http://localhost:5341",
185185
"ApiKey": "XXXX"
@@ -200,6 +200,15 @@ App Settings
200200
"Company": "MyCompany",
201201
"ProductVersion": "1.0.0",
202202
"SourceType": "_json"
203+
},
204+
"DataDogOptions": {
205+
"Enabled": false,
206+
"MinimumLevel": "Verbose",
207+
"ApiKey": "XXX",
208+
"Service": null,
209+
"Source": null,
210+
"Host": null,
211+
"Tags": []
203212
}
204213
},
205214
"DocsSettings": {

README.md.bak

Lines changed: 244 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,244 @@
1+
<!-- [![Build status](https://ci.appveyor.com/api/projects/status/9jkiyh848g2djqkn/branch/master?svg=true)](https://ci.appveyor.com/project/ThiagoBarradas/aspnet-scaffolding/branch/master)
2+
[![Codacy Badge](https://api.codacy.com/project/badge/Grade/a833f89548944fad8405aa6c9599edd4)](https://www.codacy.com/app/ThiagoBarradas/aspnet-scaffolding?utm_source=github.com&amp;utm_medium=referral&amp;utm_content=ThiagoBarradas/aspnet-scaffolding&amp;utm_campaign=Badge_Grade) -->
3+
[![NuGet Downloads](https://img.shields.io/nuget/dt/AspNetScaffolding3.svg)](https://www.nuget.org/packages/AspNetScaffolding3/)
4+
[![NuGet Version](https://img.shields.io/nuget/v/AspNetScaffolding3.svg)](https://www.nuget.org/packages/AspNetScaffolding3/)
5+
6+
# AspNetScaffolding3
7+
8+
Build web api fast and easily with aspnet core > 3.1
9+
10+
## Install via NuGet
11+
12+
```
13+
PM> Install-Package AspNetScaffolding3
14+
```
15+
16+
# Create An Application
17+
18+
Basic steps:
19+
20+
- Creates a new empty web api project with aspnet core 3.1;
21+
- Edit your `Program.cs` like example;
22+
- Edit your `Startup.cs` like example;
23+
- Create your `appsettings.json` and per environment, like `appsettings.Staging.json` (Environment is obtained by `ASPNETCORE_ENVIRONMENT`)
24+
- Create your controllers inherit from `BaseController` from AspNetScaffolding;
25+
- FluentValidation is automatic configured, just implements validator and use `this.Validate(obj);` in your action;
26+
- This project uses `WebApi.Models` and can handler `ApiResponse` and `ApiException` like `NotFoundException`, `BadRequestException`, `UnauthorizedException`, etc;
27+
- This project includes restsharp autolog for serilog with current RequestKey;
28+
- To use AutoMapper you only need to create your mapping inheriting from Profile;
29+
30+
```c#
31+
// Program.cs
32+
33+
public class Program
34+
{
35+
public static void Main(string[] args)
36+
{
37+
var config = new ApiBasicConfiguration
38+
{
39+
ApiName = "My AspNet Scaffolding",
40+
ApiPort = 8700,
41+
EnvironmentVariablesPrefix = "Prefix_",
42+
ConfigureHealthcheck = Startup.ConfigureHealthcheck,
43+
ConfigureServices = Startup.ConfigureServices,
44+
Configure = Startup.Configure,
45+
AutoRegisterAssemblies = new Assembly[]
46+
{ Assembly.GetExecutingAssembly() }
47+
};
48+
49+
Api.Run(config);
50+
}
51+
}
52+
```
53+
54+
```c#
55+
// Startup.cs
56+
57+
public static class Startup
58+
{
59+
public static void ConfigureHealthcheck(IHealthChecksBuilder builder, IServiceProvider provider)
60+
{
61+
// add health check configuration
62+
builder.AddMongoDb("mongodb://localhost:27017");
63+
}
64+
65+
public static void ConfigureServices(IServiceCollection services)
66+
{
67+
// add services
68+
services.AddSingleton<ISomething, Something>();
69+
}
70+
71+
public static void Configure(IApplicationBuilder app)
72+
{
73+
// customize your app
74+
app.UseAuthentication();
75+
}
76+
}
77+
78+
```
79+
80+
App Settings
81+
```json
82+
// appsettings.{environment}.json or appsettings.json
83+
84+
{
85+
"ApiSettings": {
86+
"AppUrl": "http://localhost:8700",
87+
"JsonSerializer": "Snakecase",
88+
"PathPrefix": "myapp/{version}",
89+
"UseStaticFiles": true,
90+
"StaticFilesPath": "assets",
91+
"Domain": "MyDomain",
92+
"Application": "MyApp",
93+
"Version": "v1",
94+
"BuildVersion": "1.0.0",
95+
"UseOriginalEnumValue": false,
96+
"SupportedCultures": [ "pt-BR", "es-ES", "en-US" ],
97+
"RequestKeyProperty": "RequestKey",
98+
"AccountIdProperty": "AccountId",
99+
"TimezoneHeader": "Timezone",
100+
"TimezoneDefault": "America/Sao_Paulo",
101+
"TimeElapsedProperty": "X-Internal-Time",
102+
"JsonFieldSelectorProperty": "fields"
103+
},
104+
"HealthcheckSettings": {
105+
"Enabled": true,
106+
"Path": "healthcheck",
107+
"LogEnabled": false
108+
},
109+
"ShutdownSettings": {
110+
"ShutdownTimeoutIsSeconds" : 30,
111+
"Enabled" : true,
112+
"Redirect" : false
113+
},
114+
"DbSettings": {
115+
"ConnectionString": "mongodb://user:pass@localhost:27017/DatabaseName",
116+
"Name": "DatabaseName"
117+
},
118+
"CacheSettings": {
119+
"Enabled": true,
120+
"UseRedis": true,
121+
"UseLocker": true,
122+
"TimeoutInMs": 1000,
123+
"Ssl": false,
124+
"Password": "RedisAuth",
125+
"Host": "localhost",
126+
"Port": 6379,
127+
"LockerPrefix": "app-locker-",
128+
"LockerTtlInSeconds": 100,
129+
"LockerDb": 0,
130+
"CachePrefix": "app-cache-",
131+
"CacheTtlInSeconds": 900,
132+
"CacheDb": 0
133+
},
134+
"QueueSettings": {
135+
"Enabled": false,
136+
"RetryTTL": 20000,
137+
"RetryTTLFactor": 2.0,
138+
"RetryCount": 5,
139+
"QueueConnectionString": "amqp://guest:guest@localhost:5672/VHost",
140+
"VHostApi": "http://guest:guest@localhost:15672/api/queues/VHost",
141+
"QueueName": "my-queue",
142+
"ExchangeToSubscribe": "main.topic",
143+
"EventsToSubscribe": "event.something.created,event.other.#",
144+
"MaxThreads": 200,
145+
"AutoAckOnSuccess": true
146+
},
147+
"IpRateLimiting": {
148+
"Enabled" : true,
149+
"EnableEndpointRateLimiting": false,
150+
"StackBlockedRequests": false,
151+
"RealIpHeader": "X-Real-IP",
152+
"ClientIdHeader": "X-ClientId",
153+
"HttpStatusCode": 429,
154+
"IpWhitelist": [],
155+
"EndpointWhitelist": [],
156+
"ClientWhitelist": [],
157+
"GeneralRules": [
158+
{
159+
"Endpoint": "*",
160+
"Period": "1m",
161+
"Limit": 5
162+
},
163+
{
164+
"Endpoint": "*",
165+
"Period": "1h",
166+
"Limit": 1000
167+
}
168+
],
169+
"QuotaExceededResponse": {
170+
"Content": "{{ \"message\": \"Quota exceeded. Maximum allowed: {0} per {1}. Please try again in {2} second(s).\" }}",
171+
"ContentType": "application/json",
172+
"StatusCode": 429
173+
}
174+
},
175+
"LogSettings": {
176+
"IgnoredRoutes": [],
177+
"DebugEnabled": true,
178+
"TitlePrefix": "[{Application}] ",
179+
"JsonBlacklistRequest": [ "*password", "*card.number", "*creditcardnumber", "*cvv" ],
180+
"JsonBlacklistResponse": [ "*password", "*card.number", "*creditcardnumber", "*cvv" ],
181+
"SeqOptions": {
182+
"Enabled": true,
183+
"MinimumLevel": "Verbose",
184+
"Url": "http://localhost:5341",
185+
"ApiKey": "XXXX"
186+
},
187+
"NewRelicOptions": {
188+
"Enabled": false,
189+
"AppName": "Verbose",
190+
"LicenseKey": "XXXX"
191+
},
192+
"SplunkOptions": {
193+
"Enabled": false,
194+
"MinimumLevel": "Verbose",
195+
"Url": "http://localhost:8088/services/collector",
196+
"Token": "XXXX",
197+
"Index": "my.index",
198+
"Application": "MyApp :Ds",
199+
"ProcessName": "Domain.App",
200+
"Company": "MyCompany",
201+
"ProductVersion": "1.0.0",
202+
"SourceType": "_json"
203+
},
204+
"DataDogOptions": {
205+
"Enabled": false,
206+
"MinimumLevel": "Verbose",
207+
"ApiKey": "XXX",
208+
"Service": null,
209+
"Source": null,
210+
"Host": null,
211+
"Tags": []
212+
}
213+
},
214+
"DocsSettings": {
215+
"Enabled": true,
216+
"Title": "MyApp API Reference",
217+
"AuthorName": "Thiago Barradas",
218+
"AuthorEmail": "[email protected]",
219+
"PathToReadme": "DOCS.md",
220+
"IgnoredEnums": [ "none", "undefined" ]
221+
}
222+
}
223+
224+
```
225+
226+
## How can I contribute?
227+
228+
Please, refer to [CONTRIBUTING](.github/CONTRIBUTING.md)
229+
230+
## Found something strange or need a new feature?
231+
232+
Open a new Issue following our issue template [ISSUE_TEMPLATE](.github/ISSUE_TEMPLATE.md)
233+
234+
## Changelog
235+
236+
See in [nuget version history](https://www.nuget.org/packages/AspNetScaffolding3)
237+
238+
## Did you like it? Please, make a donate :)
239+
240+
if you liked this project, please make a contribution and help to keep this and other initiatives, send me some Satochis.
241+
242+
BTC Wallet: `1G535x1rYdMo9CNdTGK3eG6XJddBHdaqfX`
243+
244+
![1G535x1rYdMo9CNdTGK3eG6XJddBHdaqfX](https://i.imgur.com/mN7ueoE.png)

0 commit comments

Comments
 (0)