Skip to content

Commit 0fc0052

Browse files
feat: enable automated RDS and Redis credential rotation
1 parent 8ddf1e7 commit 0fc0052

50 files changed

Lines changed: 5552 additions & 1303 deletions

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

backend/.env.example

Lines changed: 44 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -43,10 +43,28 @@ PGUSER=
4343
PGPASSWORD=
4444
# PostgreSQL database name | string | # Optional (default: empty)
4545
PGDATABASE=
46+
# AWS Secrets Manager ARN for RDS credentials; overrides static PG* credentials after hydration | ARN | # Optional (default: empty)
47+
DB_SECRET_ARN=
48+
# Alias for DB_SECRET_ARN | ARN | # Optional (default: empty)
49+
DATABASE_SECRET_ARN=
50+
# Alias for DB_SECRET_ARN | ARN | # Optional (default: empty)
51+
PG_SECRET_ARN=
52+
# Database secret refresh TTL | integer milliseconds | # Optional (default: 300000)
53+
DB_SECRET_CACHE_TTL_MS=300000
54+
# AWS region used by the Secrets Manager client in AWS/ECS deployments | AWS region | # Optional (default: SDK chain)
55+
AWS_REGION=
56+
# Alias region variable recognized by the AWS SDK | AWS region | # Optional (default: SDK chain)
57+
AWS_DEFAULT_REGION=
4658
# Maximum number of connections in the PostgreSQL pool | integer | # Optional (default: 10)
4759
DB_POOL_SIZE=10
4860
# CI marker used by tooling and env validation checks | string | # Optional (default: empty)
4961
CI=
62+
# Vitest runtime marker used by test-only Redis mocks | boolean | # Optional (default: empty)
63+
VITEST=
64+
# Public application URL used in notification links | URL | # Optional (default: empty)
65+
APP_URL=
66+
# Public API URL used in notification links | URL | # Optional (default: empty)
67+
API_URL=
5068
# SQLite database file path for local/test usage | filesystem path | # Optional (default: ./data/portfolio.db)
5169
DB_PATH=./data/portfolio.db
5270

@@ -59,6 +77,10 @@ REFLECTOR_API_URL=
5977
PRICE_CACHE_DURATION=300000
6078
# Minimum interval between upstream price fetches | integer milliseconds | # Optional (default: 90000)
6179
MIN_REQUEST_INTERVAL=90000
80+
# Redis-backed oracle cache TTL | integer seconds | # Optional (default: 30)
81+
ORACLE_CACHE_TTL_SECONDS=30
82+
# Issuer metadata cache TTL | integer milliseconds | # Optional (default: 21600000)
83+
ISSUER_METADATA_TTL_MS=21600000
6284

6385
# --- Auto-rebalancer ---
6486
# Enables queue-backed automatic rebalance checks | boolean | # Optional (default: false)
@@ -85,12 +107,24 @@ RATE_LIMIT_CRITICAL_MAX=3
85107
RATE_LIMIT_BURST_WINDOW_MS=10000
86108
# Max global requests in burst window | integer | # Optional (default: 20)
87109
RATE_LIMIT_BURST_MAX=20
110+
# Alias for RATE_LIMIT_MAX | integer | # Optional (default: 100)
111+
RATE_LIMIT_GLOBAL_MAX=100
112+
# Alias for RATE_LIMIT_WINDOW_MS | integer milliseconds | # Optional (default: 900000)
113+
RATE_LIMIT_GLOBAL_WINDOW_MS=900000
88114
# Max write requests in burst window | integer | # Optional (default: 3)
89115
RATE_LIMIT_WRITE_BURST_MAX=3
90116

91117
# --- Queue and caching ---
92118
# Redis URL for BullMQ queues/workers | URL | # Optional (default: redis://localhost:6379)
93119
REDIS_URL=redis://localhost:6379
120+
# AWS Secrets Manager ARN for Redis endpoint/AUTH token JSON; dynamically builds REDIS_URL | ARN | # Optional (default: empty)
121+
REDIS_SECRET_ARN=
122+
# Alias for REDIS_SECRET_ARN | ARN | # Optional (default: empty)
123+
REDIS_AUTH_SECRET_ARN=
124+
# Redis secret refresh TTL | integer milliseconds | # Optional (default: 300000)
125+
REDIS_SECRET_CACHE_TTL_MS=300000
126+
# Redis availability probe cache TTL | integer milliseconds | # Optional (default: 30000)
127+
REDIS_AVAILABILITY_CACHE_TTL_MS=30000
94128
# Toggle in-memory portfolio cache for experiments | boolean | # Optional (default: false)
95129
USE_MEMORY_CACHE=false
96130

@@ -133,6 +167,10 @@ SMTP_USER=your-email@gmail.com
133167
SMTP_PASS=your-app-password
134168
# Default sender email for notifications | email | # Optional (default: noreply@stellarportfolio.com)
135169
SMTP_FROM=noreply@stellarportfolio.com
170+
# Secret used to sign unsubscribe tokens | string | # Optional (default: SMTP_PASS fallback)
171+
UNSUBSCRIBE_SECRET=
172+
# Telegram bot token for notification delivery | string | # Optional (default: empty)
173+
TELEGRAM_BOT_TOKEN=
136174
# Comma-separated admin signer addresses for privileged routes | CSV of Stellar public keys | # Optional (default: empty)
137175
ADMIN_PUBLIC_KEYS=
138176
# Outbound webhook request timeout | integer milliseconds | # Optional (default: 5000)
@@ -195,6 +233,8 @@ RISK_CONCENTRATION_CRITICAL=80
195233
RISK_LIQUIDITY_LOW=1000
196234
# Critical-liquidity threshold | decimal USD | # Optional (default: 500)
197235
RISK_LIQUIDITY_CRITICAL=500
236+
# Base fee assumption for rebalance dry-run estimates | integer stroops | # Optional (default: 100)
237+
REBALANCE_DRY_RUN_BASE_FEE_STROOPS=100
198238

199239
# --- Analytics ---
200240
# Background snapshot interval per portfolio | integer milliseconds | # Optional (default: 300000)
@@ -211,6 +251,8 @@ CONSENT_AUDIT_RETENTION_DAYS=365
211251
JWT_SECRET=
212252
# Access token expiry | integer seconds | # Optional (default: 900)
213253
JWT_ACCESS_EXPIRY_SEC=900
254+
# Allowed JWT clock skew | integer seconds | # Optional (default: 0)
255+
JWT_CLOCK_SKEW_SEC=0
214256
# Refresh token expiry | integer seconds | # Optional (default: 604800)
215257
JWT_REFRESH_EXPIRY_SEC=604800
216258
# Previous JWT secret used during key rotation grace period | string | # Optional (default: empty)
@@ -221,6 +263,8 @@ JWT_PREVIOUS_SECRET_GRACE_UNTIL=
221263
API_RATE_LIMIT_WINDOW=900000
222264
# API-level rate-limit max requests in window | integer | # Optional (default: 100)
223265
API_RATE_LIMIT_MAX_REQUESTS=100
266+
# Shared secret for trusted health/readiness probes | string | # Optional (default: empty)
267+
HEALTH_PROBE_SECRET=
224268
# Request timeout for outbound/internal operations | integer milliseconds | # Optional (default: 30000)
225269
REQUEST_TIMEOUT=30000
226270
# Enable request schema validation | boolean | # Optional (default: true)
@@ -263,11 +307,6 @@ SOROBAN_EVENT_INDEXER_MAX_PAGES=10
263307
# Declared contract event schema version to enforce compatibility | integer | # Optional (default: 1)
264308
CONTRACT_EVENT_SCHEMA_VERSION=1
265309

266-
# --- Consent and readiness cache ---
267-
# Retention window for consent audit records | integer days | # Optional (default: 365)
268-
CONSENT_AUDIT_RETENTION_DAYS=365
269-
# Cache TTL for readiness checks | integer milliseconds | # Optional (default: 2000)
270-
READINESS_CACHE_TTL_MS=2000
271310

272311
# --- Observability ---
273312
# Enable OpenTelemetry tracing | boolean | # Optional (default: false)

0 commit comments

Comments
 (0)