-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathappsettings.json
More file actions
67 lines (62 loc) · 2.75 KB
/
appsettings.json
File metadata and controls
67 lines (62 loc) · 2.75 KB
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
{
// IOptions<T> Configuration Example for .NET 8
// This file demonstrates modern, strongly-typed configuration patterns
"Application": {
"Name": "SharePoint Sync Tool",
"Version": "2.0.0",
"LogLevel": "Information",
"EnableMetrics": true,
"EnableHealthChecks": true,
"Environment": "Production"
},
// SharePoint configuration section - mapped to SharePointOptions class
// Validation: All properties are validated on startup via [Required], [EmailAddress], [Url], [Range] attributes
// Security: Sensitive values (Username, Password) should be stored in:
// - User Secrets for development: dotnet user-secrets set "SharePoint:Password" "your-password"
// - Environment Variables for production: SPO2SQL_SharePoint__Password=your-password
"SharePoint": {
"Username": "", // Required, must be valid email address
"Password": "", // Required, use secrets management (not plaintext!)
"SiteUrl": "https://yourcompany.sharepoint.com/sites/yoursite", // Required, must be valid URL
"TimeoutSeconds": 120, // Range: 10-600 seconds
"MaxRetries": 3, // Range: 0-10 retries
"InitialRetryDelayMs": 1000 // Range: 100-10000 milliseconds
},
// SQL Server configuration section - mapped to SqlOptions class
// Nested configuration example: All properties validated on startup
"Sql": {
"ConnectionString": "", // Required, min length 10, use secrets management!
"CommandTimeoutSeconds": 300, // Range: 10-3600 seconds
"BatchSize": 80, // Range: 10-1000, affects bulk operation performance
"EnforceEncryption": true // Security best practice
},
// Logging configuration - built-in .NET configuration, not using IOptions<T>
// This is configured directly by the logging subsystem
"Logging": {
"LogLevel": {
"Default": "Information",
"Microsoft": "Warning",
"Microsoft.Hosting.Lifetime": "Information",
"System": "Warning"
},
"Console": {
"FormatterName": "simple",
"FormatterOptions": {
"TimestampFormat": "yyyy-MM-dd HH:mm:ss ",
"UseUtcTimestamp": false
}
}
}
// Configuration Override Priority (highest to lowest):
// 1. Command-line arguments: --SharePoint:SiteUrl "https://custom.sharepoint.com"
// 2. Environment variables: SPO2SQL_SharePoint__SiteUrl=https://custom.sharepoint.com
// 3. User secrets (Development): dotnet user-secrets set "SharePoint:SiteUrl" "https://dev.sharepoint.com"
// 4. appsettings.{Environment}.json: appsettings.Development.json
// 5. appsettings.json (this file)
//
// Example: Override batch size via environment variable:
// export SPO2SQL_Sql__BatchSize=100
//
// Example: Override via command line:
// dotnet run --SharePoint:MaxRetries 5 --Sql:BatchSize 100
}