Skip to content

Commit f92be42

Browse files
feat(config): add env-specific YML variants, docker override, and config integration tests
Complete remaining BD-845 epic sub-tasks: - Add OrderMonitor_ENV.staging.yml with staging-specific settings (30min scanner interval, debug logging, staging alert prefix) - Add OrderMonitor_ENV.production.yml with production-optimized settings (pool=20, timeout=60s, swagger disabled, info logging only) - Add docker-compose.override.yml with SQL Server 2022 service, optional PostgreSQL (commented), volumes, and debug port - Add 18 configuration integration tests covering: - Startup validation fail-fast (7 tests) - Configuration binding from IOptions<T> (10 tests) - Override precedence verification (1 test) Tests: 196 unit + 53 integration = 249 total, all passing. Closes BD-850, BD-858, BD-878, BD-879, BD-880, BD-881, BD-882, BD-883, BD-884, BD-885, BD-886, BD-887, BD-888, BD-889, BD-890, BD-891, BD-892, BD-893, BD-894, BD-895, BD-896, BD-897, BD-898, BD-899, BD-900, BD-901, BD-902, BD-903, BD-904 Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
1 parent d496dee commit f92be42

4 files changed

Lines changed: 867 additions & 0 deletions

File tree

OrderMonitor_ENV.production.yml

Lines changed: 143 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,143 @@
1+
# ==============================================================================
2+
# OrderMonitor API - Production Environment Configuration
3+
# ==============================================================================
4+
# Production environment-specific settings for the Order Monitor API.
5+
# Optimized for performance, reliability, and security with frequent scanning
6+
# and information-level logging only.
7+
#
8+
# Override precedence (highest to lowest):
9+
# 1. Kubernetes Secrets (sensitive values)
10+
# 2. Kubernetes ConfigMap (non-sensitive config)
11+
# 3. OS environment variables
12+
# 4. This file (OrderMonitor_ENV.production.yml)
13+
#
14+
# CRITICAL: All secrets MUST be empty and injected via Kubernetes Secrets.
15+
# Never commit production secrets to version control.
16+
#
17+
# Supported database providers: sqlserver, mysql, postgresql
18+
# ==============================================================================
19+
20+
# ------------------------------------------------------------------------------
21+
# Application Settings
22+
# ------------------------------------------------------------------------------
23+
ASPNETCORE_ENVIRONMENT: "Production"
24+
ASPNETCORE_URLS: "http://+:8080"
25+
26+
# ------------------------------------------------------------------------------
27+
# Database Configuration (Multi-Provider)
28+
# ------------------------------------------------------------------------------
29+
# Database provider: "sqlserver" | "mysql" | "postgresql"
30+
ORDERMONITOR__Database__Provider: "sqlserver"
31+
32+
# Connection string in Prisma URL format (varies by provider):
33+
# sqlserver: sqlserver://HOST:PORT;database=DB;user=USER;password=PASS;encrypt=true
34+
# mysql: mysql://USER:PASS@HOST:PORT/DB
35+
# postgresql: postgresql://USER:PASS@HOST:PORT/DB?schema=public
36+
# INJECTED VIA KUBERNETES SECRETS - NEVER COMMIT REAL CONNECTION STRINGS
37+
ORDERMONITOR__Database__ConnectionString: ""
38+
39+
# Encrypted password (replaces {ENCRYPTED} placeholder in connection string)
40+
# Leave empty if password is included directly in connection string
41+
# INJECTED VIA KUBERNETES SECRETS
42+
ORDERMONITOR__Database__EncryptedPassword: ""
43+
44+
# AES-256 encryption key (exactly 32 characters)
45+
# REQUIRED if using encrypted passwords. INJECTED VIA KUBERNETES SECRETS.
46+
# CRITICAL: NEVER commit the real encryption key to version control.
47+
ORDERMONITOR__Database__EncryptionKey: ""
48+
49+
# Connection pool size for production (optimized for high throughput)
50+
ORDERMONITOR__Database__MaxPoolSize: "20"
51+
52+
# Query timeout in seconds (longer for production reporting queries)
53+
ORDERMONITOR__Database__CommandTimeout: "60"
54+
55+
# ------------------------------------------------------------------------------
56+
# SMTP / Email Settings
57+
# ------------------------------------------------------------------------------
58+
ORDERMONITOR__SmtpSettings__Host: "pod51017.outlook.com"
59+
ORDERMONITOR__SmtpSettings__Port: "587"
60+
ORDERMONITOR__SmtpSettings__Username: "backoffice@printerpix.com"
61+
ORDERMONITOR__SmtpSettings__FromEmail: "backoffice@printerpix.com"
62+
ORDERMONITOR__SmtpSettings__UseSsl: "true"
63+
64+
# SMTP password (encrypted). INJECTED VIA KUBERNETES SECRETS.
65+
ORDERMONITOR__SmtpSettings__Password: ""
66+
67+
# ------------------------------------------------------------------------------
68+
# Alert Settings
69+
# Production uses professional alert subject prefix
70+
# ------------------------------------------------------------------------------
71+
ORDERMONITOR__Alerts__Enabled: "true"
72+
ORDERMONITOR__Alerts__SubjectPrefix: "[Order Monitor]"
73+
74+
# Alert recipients (indexed array format for ASP.NET Core)
75+
ORDERMONITOR__Alerts__Recipients__0: "ranganathan.e@syncoms.com"
76+
# ORDERMONITOR__Alerts__Recipients__1: ""
77+
# ORDERMONITOR__Alerts__Recipients__2: ""
78+
# ORDERMONITOR__Alerts__Recipients__3: ""
79+
80+
# ------------------------------------------------------------------------------
81+
# Background Scanner Settings
82+
# Production uses frequent scanning for optimal order monitoring
83+
# ------------------------------------------------------------------------------
84+
ORDERMONITOR__Scanner__Enabled: "true"
85+
ORDERMONITOR__Scanner__IntervalMinutes: "15"
86+
ORDERMONITOR__Scanner__BatchSize: "1000"
87+
88+
# ------------------------------------------------------------------------------
89+
# Status Threshold Configuration
90+
# ------------------------------------------------------------------------------
91+
# Prep statuses (order preparation phase)
92+
ORDERMONITOR__StatusThresholds__PrepStatuses__MinStatusId: "3001"
93+
ORDERMONITOR__StatusThresholds__PrepStatuses__MaxStatusId: "3910"
94+
ORDERMONITOR__StatusThresholds__PrepStatuses__ThresholdHours: "6"
95+
96+
# Facility statuses (manufacturing/shipping phase)
97+
ORDERMONITOR__StatusThresholds__FacilityStatuses__MinStatusId: "4001"
98+
ORDERMONITOR__StatusThresholds__FacilityStatuses__MaxStatusId: "5830"
99+
ORDERMONITOR__StatusThresholds__FacilityStatuses__ThresholdHours: "48"
100+
101+
# Default threshold for unknown statuses
102+
ORDERMONITOR__StatusThresholds__DefaultThresholdHours: "24"
103+
104+
# ------------------------------------------------------------------------------
105+
# Business Hours Configuration
106+
# ------------------------------------------------------------------------------
107+
# Timezone for business hours calculation (IANA format)
108+
ORDERMONITOR__BusinessHours__Timezone: "Europe/London"
109+
110+
# Business day start/end hours (24h format)
111+
ORDERMONITOR__BusinessHours__StartHour: "0"
112+
ORDERMONITOR__BusinessHours__EndHour: "24"
113+
114+
# Holiday dates (comma-separated, ISO 8601)
115+
# Override default UK/EU holidays if needed
116+
# ORDERMONITOR__BusinessHours__Holidays: "2026-01-01,2026-04-03,2026-04-06,2026-05-04,2026-05-25,2026-08-31,2026-12-25,2026-12-28"
117+
118+
# ------------------------------------------------------------------------------
119+
# Logging Configuration
120+
# Production uses Information level only (no debug logging for performance)
121+
# ------------------------------------------------------------------------------
122+
ORDERMONITOR__Logging__LogLevel__Default: "Information"
123+
ORDERMONITOR__Logging__LogLevel__Microsoft_AspNetCore: "Warning"
124+
ORDERMONITOR__Logging__LogLevel__OrderMonitor: "Information"
125+
126+
# Serilog overrides (optional)
127+
# ORDERMONITOR__Serilog__MinimumLevel__Default: "Information"
128+
# ORDERMONITOR__Serilog__WriteTo__0__Name: "Console"
129+
130+
# ------------------------------------------------------------------------------
131+
# Health Check Settings
132+
# Production includes database health checks
133+
# ------------------------------------------------------------------------------
134+
ORDERMONITOR__HealthCheck__Path: "/health"
135+
ORDERMONITOR__HealthCheck__IncludeDatabase: "true"
136+
137+
# ------------------------------------------------------------------------------
138+
# Swagger / API Documentation
139+
# Production typically has Swagger disabled for security
140+
# ------------------------------------------------------------------------------
141+
ORDERMONITOR__Swagger__Enabled: "false"
142+
ORDERMONITOR__Swagger__Title: "Order Monitor API"
143+
ORDERMONITOR__Swagger__Version: "v2"

OrderMonitor_ENV.staging.yml

Lines changed: 141 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,141 @@
1+
# ==============================================================================
2+
# OrderMonitor API - Staging Environment Configuration
3+
# ==============================================================================
4+
# Staging environment-specific settings for the Order Monitor API.
5+
# Inherits base configuration from OrderMonitor_ENV.yml with staging-specific
6+
# overrides for reduced scanning frequency and debug logging.
7+
#
8+
# Override precedence (highest to lowest):
9+
# 1. Kubernetes Secrets (sensitive values)
10+
# 2. Kubernetes ConfigMap (non-sensitive config)
11+
# 3. OS environment variables
12+
# 4. This file (OrderMonitor_ENV.staging.yml)
13+
#
14+
# IMPORTANT: All secrets are left empty and injected via Kubernetes Secrets.
15+
# Never commit production secrets to this file.
16+
#
17+
# Supported database providers: sqlserver, mysql, postgresql
18+
# ==============================================================================
19+
20+
# ------------------------------------------------------------------------------
21+
# Application Settings
22+
# ------------------------------------------------------------------------------
23+
ASPNETCORE_ENVIRONMENT: "Staging"
24+
ASPNETCORE_URLS: "http://+:8080"
25+
26+
# ------------------------------------------------------------------------------
27+
# Database Configuration (Multi-Provider)
28+
# ------------------------------------------------------------------------------
29+
# Database provider: "sqlserver" | "mysql" | "postgresql"
30+
ORDERMONITOR__Database__Provider: "sqlserver"
31+
32+
# Connection string in Prisma URL format (varies by provider):
33+
# sqlserver: sqlserver://HOST:PORT;database=DB;user=USER;password=PASS;encrypt=true
34+
# mysql: mysql://USER:PASS@HOST:PORT/DB
35+
# postgresql: postgresql://USER:PASS@HOST:PORT/DB?schema=public
36+
# INJECTED VIA KUBERNETES SECRETS
37+
ORDERMONITOR__Database__ConnectionString: ""
38+
39+
# Encrypted password (replaces {ENCRYPTED} placeholder in connection string)
40+
# Leave empty if password is included directly in connection string
41+
# INJECTED VIA KUBERNETES SECRETS
42+
ORDERMONITOR__Database__EncryptedPassword: ""
43+
44+
# AES-256 encryption key (exactly 32 characters)
45+
# REQUIRED if using encrypted passwords. INJECTED VIA KUBERNETES SECRETS.
46+
# NEVER commit the real key to version control.
47+
ORDERMONITOR__Database__EncryptionKey: ""
48+
49+
# Connection pool size for staging (moderate)
50+
ORDERMONITOR__Database__MaxPoolSize: "15"
51+
52+
# Query timeout in seconds
53+
ORDERMONITOR__Database__CommandTimeout: "45"
54+
55+
# ------------------------------------------------------------------------------
56+
# SMTP / Email Settings
57+
# ------------------------------------------------------------------------------
58+
ORDERMONITOR__SmtpSettings__Host: "pod51017.outlook.com"
59+
ORDERMONITOR__SmtpSettings__Port: "587"
60+
ORDERMONITOR__SmtpSettings__Username: "backoffice@printerpix.com"
61+
ORDERMONITOR__SmtpSettings__FromEmail: "backoffice@printerpix.com"
62+
ORDERMONITOR__SmtpSettings__UseSsl: "true"
63+
64+
# SMTP password (encrypted). Injected via K8s Secret.
65+
ORDERMONITOR__SmtpSettings__Password: ""
66+
67+
# ------------------------------------------------------------------------------
68+
# Alert Settings
69+
# ------------------------------------------------------------------------------
70+
ORDERMONITOR__Alerts__Enabled: "true"
71+
ORDERMONITOR__Alerts__SubjectPrefix: "[Order Monitor - STAGING]"
72+
73+
# Alert recipients (indexed array format for ASP.NET Core)
74+
ORDERMONITOR__Alerts__Recipients__0: "ranganathan.e@syncoms.com"
75+
# ORDERMONITOR__Alerts__Recipients__1: ""
76+
# ORDERMONITOR__Alerts__Recipients__2: ""
77+
# ORDERMONITOR__Alerts__Recipients__3: ""
78+
79+
# ------------------------------------------------------------------------------
80+
# Background Scanner Settings
81+
# Staging uses less frequent scanning to reduce load
82+
# ------------------------------------------------------------------------------
83+
ORDERMONITOR__Scanner__Enabled: "true"
84+
ORDERMONITOR__Scanner__IntervalMinutes: "30"
85+
ORDERMONITOR__Scanner__BatchSize: "500"
86+
87+
# ------------------------------------------------------------------------------
88+
# Status Threshold Configuration
89+
# ------------------------------------------------------------------------------
90+
# Prep statuses (order preparation phase)
91+
ORDERMONITOR__StatusThresholds__PrepStatuses__MinStatusId: "3001"
92+
ORDERMONITOR__StatusThresholds__PrepStatuses__MaxStatusId: "3910"
93+
ORDERMONITOR__StatusThresholds__PrepStatuses__ThresholdHours: "6"
94+
95+
# Facility statuses (manufacturing/shipping phase)
96+
ORDERMONITOR__StatusThresholds__FacilityStatuses__MinStatusId: "4001"
97+
ORDERMONITOR__StatusThresholds__FacilityStatuses__MaxStatusId: "5830"
98+
ORDERMONITOR__StatusThresholds__FacilityStatuses__ThresholdHours: "48"
99+
100+
# Default threshold for unknown statuses
101+
ORDERMONITOR__StatusThresholds__DefaultThresholdHours: "24"
102+
103+
# ------------------------------------------------------------------------------
104+
# Business Hours Configuration
105+
# ------------------------------------------------------------------------------
106+
# Timezone for business hours calculation (IANA format)
107+
ORDERMONITOR__BusinessHours__Timezone: "Europe/London"
108+
109+
# Business day start/end hours (24h format)
110+
ORDERMONITOR__BusinessHours__StartHour: "0"
111+
ORDERMONITOR__BusinessHours__EndHour: "24"
112+
113+
# Holiday dates (comma-separated, ISO 8601)
114+
# Override default UK/EU holidays if needed
115+
# ORDERMONITOR__BusinessHours__Holidays: "2026-01-01,2026-04-03,2026-04-06,2026-05-04,2026-05-25,2026-08-31,2026-12-25,2026-12-28"
116+
117+
# ------------------------------------------------------------------------------
118+
# Logging Configuration
119+
# Staging uses Debug logging for OrderMonitor namespace for troubleshooting
120+
# ------------------------------------------------------------------------------
121+
ORDERMONITOR__Logging__LogLevel__Default: "Information"
122+
ORDERMONITOR__Logging__LogLevel__Microsoft_AspNetCore: "Warning"
123+
ORDERMONITOR__Logging__LogLevel__OrderMonitor: "Debug"
124+
125+
# Serilog overrides (optional)
126+
# ORDERMONITOR__Serilog__MinimumLevel__Default: "Information"
127+
# ORDERMONITOR__Serilog__WriteTo__0__Name: "Console"
128+
129+
# ------------------------------------------------------------------------------
130+
# Health Check Settings
131+
# ------------------------------------------------------------------------------
132+
ORDERMONITOR__HealthCheck__Path: "/health"
133+
ORDERMONITOR__HealthCheck__IncludeDatabase: "true"
134+
135+
# ------------------------------------------------------------------------------
136+
# Swagger / API Documentation
137+
# Staging typically has Swagger enabled for testing
138+
# ------------------------------------------------------------------------------
139+
ORDERMONITOR__Swagger__Enabled: "true"
140+
ORDERMONITOR__Swagger__Title: "Order Monitor API (Staging)"
141+
ORDERMONITOR__Swagger__Version: "v2"

0 commit comments

Comments
 (0)