/
template.json
438 lines (437 loc) · 13.7 KB
/
template.json
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
// https://github.com/dotnet/templating/wiki/%22Runnable-Project%22-Templates#configuration
{
"$schema": "http://json.schemastore.org/template",
"author": "Muhammad Rehan Saeed (RehanSaeed.com)",
"classifications": [ "Web", "WebAPI", "Boxed", "Swagger", "API" ],
"name": "ASP.NET Core API Boxed",
"groupIdentity": "Dotnet.Boxed.API",
"identity": "Dotnet.Boxed.API.CSharp",
"shortName": "api",
"tags": {
"language": "C#",
"type": "project"
},
"sourceName": "ApiTemplate",
"preferNameDirectory": true,
"guids": [
"837bc53e-0271-4e9c-b5b5-c60ea7a7c7b5",
"113f2d04-69f0-40c3-8797-ba3f356dd812"
],
"primaryOutputs": [
{ "path": "ApiTemplate.csproj" }
],
"sources": [
{
"modifiers": [
// Swagger
{
"condition": "(!Swagger)",
"exclude": [
"OperationFilters/**/*",
"ViewModelSchemaFilters/**/*"
]
},
// Versioning
{
"condition": "(!Versioning)",
"exclude": [
"OperationFilters/**/*"
]
},
// ReverseProxyWebServer
{
"condition": "(!IIS)",
"exclude": [
"web.config"
]
},
{
"condition": "(!NGINX)",
"exclude": [
"mime.types",
"nginx.conf"
]
},
// HttpsEverywhere
{
"condition": "(!HttpsEverywhere)",
"exclude": [
"DevelopmentCertificate.pfx"
]
},
// HealthCheck
{
"condition": "(!HealthCheck)",
"exclude": [
"Constants/StatusControllerRoute.cs",
"Controllers/StatusController.cs"
]
},
// CORS
{
"condition": "(!CORS)",
"exclude": [
"Constants/CorsPolicyName.cs"
]
},
// ResponseCompression
{
"condition": "(!ResponseCompression)",
"exclude": [
"Options/CompressionOptions.cs"
]
},
// HumansTxt
{
"condition": "(!HumansTxt)",
"exclude": [
"wwwroot/humans.txt"
]
},
// RobotsTxt
{
"condition": "(!RobotsTxt)",
"exclude": [
"wwwroot/robots.txt"
]
}
]
}
],
"symbols": {
// Title
"Title": {
"type": "parameter",
"datatype": "string",
"defaultValue": "Project Title",
"replaces": "PROJECT-TITLE",
"description": "The name of the project which determines the assembly product name. If the Swagger feature is enabled, shows the title on the Swagger UI."
},
"TitleXmlEncoded": {
"type": "derived",
"replaces": "PROJECT-TITLE-XML",
"valueSource": "Title",
"valueTransform": "xmlEncode"
},
// Description
"Description": {
"type": "parameter",
"datatype": "string",
"defaultValue": "Project Description",
"replaces": "PROJECT-DESCRIPTION",
"description": "A description of the project which determines the assembly description. If the Swagger feature is enabled, shows the description on the Swagger UI."
},
"DescriptionXmlEncoded": {
"type": "derived",
"replaces": "PROJECT-DESCRIPTION-XML",
"valueSource": "Description",
"valueTransform": "xmlEncode"
},
// Author
"Author": {
"type": "parameter",
"datatype": "string",
"defaultValue": "Project Author",
"replaces": "PROJECT-AUTHOR",
"description": "The name of the author of the project which determines the assembly author, company and copyright information."
},
"AuthorXmlEncoded": {
"type": "derived",
"replaces": "PROJECT-AUTHOR-XML",
"valueSource": "Author",
"valueTransform": "xmlEncode"
},
// TreatWarningsAsErrors
"TreatWarningsAsErrors": {
"type": "parameter",
"datatype": "bool",
"defaultValue": "true",
"description": "Treat warnings as errors."
},
// Swagger
"Swagger": {
"type": "parameter",
"datatype": "bool",
"defaultValue": "true",
"description": "Swagger is a format for describing the endpoints in your API and letting you try out your site using it's user interface."
},
// Versioning
"Versioning": {
"type": "parameter",
"datatype": "bool",
"defaultValue": "true",
"description": "Enable API versioning to version API endpoints."
},
// Forwarded Headers
"ForwardedHeaders": {
"type": "parameter",
"datatype": "bool",
"defaultValue": "true",
"description": "If you use a load balancer, updates the request host and scheme using the X-Forwarded-Host and X-Forwarded-Proto HTTP headers."
},
// Host Filtering
"HostFiltering": {
"type": "parameter",
"datatype": "bool",
"defaultValue": "true",
"description": "A white-list of host names allowed by the Kestrel web server e.g. example.com. You don't need this if you are using a properly configured reverse proxy."
},
// ReverseProxyWebServer
"ReverseProxyWebServer": {
"type": "parameter",
"datatype": "choice",
"choices": [
{
"choice": "None",
"description": "Use Kestrel directly instead of a reverse proxy."
},
{
"choice": "IIS",
"description": "A flexible, secure and manageable Web server for hosting anything on the Web using Windows Server. Select this option if you are deploying your site to Azure web apps."
},
{
"choice": "NGINX",
"description": "A free, open-source, cross-platform high-performance HTTP server and reverse proxy."
},
{
"choice": "Both",
"description": "Support both reverse proxy web servers."
}
],
"defaultValue": "Both",
"description": "The internet facing reverse proxy web server you want to use in front of the primary web server to host the site."
},
"IIS": {
"type": "computed",
"value": "(ReverseProxyWebServer == \"IIS\" || ReverseProxyWebServer == \"Both\")"
},
"NGINX": {
"type": "computed",
"value": "(ReverseProxyWebServer == \"NGINX\" || ReverseProxyWebServer == \"Both\")"
},
// CloudProvider
"CloudProvider": {
"type": "parameter",
"datatype": "choice",
"choices": [
{
"choice": "Azure",
"description": "The Microsoft Azure cloud. Adds logging features that let you see logs in the Azure portal."
},
{
"choice": "None",
"description": "No cloud provider is being used."
}
],
"defaultValue": "None",
"description": "Select which cloud provider you are using if any, to add cloud specific features."
},
"Azure": {
"type": "computed",
"value": "(CloudProvider == \"Azure\")"
},
// Analytics
"Analytics": {
"type": "parameter",
"datatype": "choice",
"choices": [
{
"choice": "Application Insights",
"description": "Monitor internal information about how your application is running, as well as external user information using the Microsoft Azure cloud."
},
{
"choice": "None",
"description": "Not using any analytics."
}
],
"defaultValue": "None",
"description": "Monitor internal information about how your application is running, as well as external user information."
},
"ApplicationInsights": {
"type": "computed",
"value": "(Analytics == \"Application Insights\")"
},
// ApplicationInsightsKey
"ApplicationInsightsKey": {
"type": "parameter",
"datatype": "string",
"replaces": "APPLICATION-INSIGHTS-INSTRUMENTATION-KEY",
"description": "Your Application Insights instrumentation key e.g. 11111111-2222-3333-4444-555555555555."
},
// HttpsEverywhere
"HttpsEverywhere": {
"type": "parameter",
"datatype": "bool",
"defaultValue": "true",
"description": "Use the HTTPS scheme and TLS security across the entire site, redirects HTTP to HTTPS and adds a Strict Transport Security (HSTS) HTTP header with preloading enabled."
},
// HstsPreload
"HstsPreload": {
"type": "parameter",
"datatype": "bool",
"defaultValue": "false",
"description": "Enable Strict Transport Security (HSTS) HTTP header with preloading."
},
// CORS
"CORS": {
"type": "parameter",
"datatype": "bool",
"defaultValue": "true",
"description": "Browser security prevents a web page from making AJAX requests to another domain."
},
// CorrelationId
"CorrelationId": {
"type": "parameter",
"datatype": "bool",
"defaultValue": "true",
"description": "Correlate requests between clients and this API. Pass a GUID in the X-Correlation-ID HTTP header to set the HttpContext.TraceIdentifier. The header is also reflected back in a response."
},
// ResponseCaching
"ResponseCaching": {
"type": "parameter",
"datatype": "bool",
"defaultValue": "true",
"description": "Response caching is allows the use of the [ResponseCache] attribute on your action methods. Cache settings (cache profiles) are stored in the configuration file and referred to by name."
},
// ResponseCompression
"ResponseCompression": {
"type": "parameter",
"datatype": "bool",
"defaultValue": "true",
"description": "Enables dynamic GZIP response compression of HTTP responses. Not enabled for HTTPS to avoid the BREACH security vulnerability."
},
// XmlFormatter
"XmlFormatter": {
"type": "parameter",
"datatype": "choice",
"choices": [
{
"choice": "DataContractSerializer",
"description": "The default XML serializer you should use. Requires the use of [DataContract] and [DataMember] attributes."
},
{
"choice": "XmlSerializer",
"description": "The alternative XML serializer which is slower but gives more control. Uses the [XmlRoot], [XmlElement] and [XmlAttribute] attributes."
},
{
"choice": "None",
"description": "No XML formatter."
}
],
"defaultValue": "None",
"description": "Choose whether to use the XML input/output formatter and which serializer to use."
},
"DataContractSerializer": {
"type": "computed",
"value": "(XmlFormatter == \"DataContractSerializer\")"
},
"XmlSerializer": {
"type": "computed",
"value": "(XmlFormatter == \"XmlSerializer\")"
},
// HealthCheck
"HealthCheck": {
"type": "parameter",
"datatype": "bool",
"defaultValue": "true",
"description": "A health-check endpoint that returns the status of this API and it's dependencies, giving an indication of it's health."
},
// RobotsTxt
"RobotsTxt": {
"type": "parameter",
"datatype": "bool",
"defaultValue": "true",
"description": "Adds a robots.txt file to tell search engines not to index this site."
},
// HumansTxt
"HumansTxt": {
"type": "parameter",
"datatype": "bool",
"defaultValue": "true",
"description": "Adds a humans.txt file where you can tell the world who wrote the application. This file is a good place to thank your developers."
},
// AuthoringMode
"AuthoringMode": {
"type": "generated",
"generator": "constant",
"parameters": {
"value": false
}
},
// HttpPort
"HttpPort": {
"type": "parameter",
"datatype": "integer",
"description": "Port number to use for the HTTP endpoint in launchSettings.json."
},
"HttpPortGenerated": {
"type": "generated",
"generator": "port"
},
"HttpPortReplacer": {
"type": "generated",
"generator": "coalesce",
"parameters": {
"sourceVariableName": "HttpPort",
"fallbackVariableName": "HttpPortGenerated"
},
"replaces": "43300"
},
// HttpsPort
"HttpsPort": {
"type": "parameter",
"datatype": "integer",
"description": "Port number to use for the HTTPS endpoint in launchSettings.json."
},
"HttpsPortGenerated": {
"type": "generated",
"generator": "port",
"parameters": {
"low": 44300,
"high": 44399
}
},
"HttpsPortReplacer": {
"type": "generated",
"generator": "coalesce",
"parameters": {
"sourceVariableName": "HttpsPort",
"fallbackVariableName": "HttpsPortGenerated"
},
"replaces": "44300"
},
// https://github.com/dotnet/templating/wiki/Post-Action-Registry
"SkipRestore": {
"type": "parameter",
"datatype": "bool",
"description": "Skips the execution of 'dotnet restore' on project creation.",
"defaultValue": "false"
},
"SkipOpenReadMe": {
"type": "parameter",
"datatype": "bool",
"description": "Skips the opening of the projects Read-Me in a web browser.",
"defaultValue": "false"
}
},
"postActions": [
{
"actionId": "210D431B-A78B-4D2F-B762-4ED3E3EA9025",
"condition": "(!SkipRestore)",
"continueOnError": true,
"description": "Restore NuGet packages required by this project.",
"manualInstructions": [
{ "text": "Run 'dotnet restore' in the directory the template was created in." }
]
},
{
"actionId": "FEA7469E-E2E7-4431-B86B-27EBC1744883",
"condition": "(!SkipOpenReadMe)",
"continueOnError": true,
"description": "Open the Read-Me for the project in a web browser.",
"manualInstructions": [
{ "text": "Open the ReadMe.html in a web browser." }
]
}
]
}