Skip to content

Commit c8289b2

Browse files
author
DeanLuus22021994
committed
feat(dapr): add environment variable substitution to components
- Update Dapr components to use \ syntax: * statestore/redis.yaml: REDIS_HOST, REDIS_PASSWORD * statestore/postgres.yaml: POSTGRES_CONNECTION_STRING * pubsub/redis.yaml: REDIS_HOST, REDIS_PASSWORD - Create comprehensive .env.example file with: * OpenAI configuration (API key - required) * Dapr configuration (ports, endpoints, state store) * Redis configuration (host, password) * PostgreSQL configuration (credentials, connection string) * Development environment (cache directories) * GPU configuration notes - All variables documented with descriptions and defaults - Consistent with docker-compose.yml environment configuration MEDIUM PRIORITY openai#5: COMPLETED - Environment variable consistency
1 parent f21d7ed commit c8289b2

File tree

4 files changed

+98
-5
lines changed

4 files changed

+98
-5
lines changed

.devcontainer/.env.example

Lines changed: 93 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,93 @@
1+
# DevContainer Environment Variables
2+
# Copy this file to .env and customize as needed
3+
4+
# =============================================================================
5+
# OpenAI Configuration
6+
# =============================================================================
7+
# Required: Your OpenAI API key for authentication
8+
OPENAI_API_KEY=your-api-key-here
9+
10+
# =============================================================================
11+
# Dapr Configuration
12+
# =============================================================================
13+
# Dapr gRPC port (default: 50001)
14+
DAPR_GRPC_PORT=50001
15+
16+
# Dapr HTTP port (default: 3500)
17+
DAPR_HTTP_PORT=3500
18+
19+
# Default Dapr state store component name (default: statestore)
20+
DAPR_STATE_STORE=statestore
21+
22+
# Dapr HTTP endpoint for bindings (default: http://dapr-sidecar:3500)
23+
DAPR_HTTP_ENDPOINT=http://dapr-sidecar:3500
24+
25+
# =============================================================================
26+
# Redis Configuration
27+
# =============================================================================
28+
# Redis host and port (default: redis:6379)
29+
REDIS_HOST=redis:6379
30+
31+
# Redis password (default: empty for no authentication)
32+
REDIS_PASSWORD=
33+
34+
# =============================================================================
35+
# PostgreSQL Configuration
36+
# =============================================================================
37+
# PostgreSQL username (default: postgres)
38+
POSTGRES_USER=postgres
39+
40+
# PostgreSQL password (default: postgres)
41+
POSTGRES_PASSWORD=postgres
42+
43+
# PostgreSQL database name (default: dapr)
44+
POSTGRES_DB=dapr
45+
46+
# PostgreSQL host (default: postgres)
47+
POSTGRES_HOST=postgres
48+
49+
# PostgreSQL port (default: 5432)
50+
POSTGRES_PORT=5432
51+
52+
# PostgreSQL connection string (auto-generated if not provided)
53+
# Format: host=HOST user=USER password=PASSWORD dbname=DB port=PORT
54+
POSTGRES_CONNECTION_STRING=host=postgres user=postgres password=postgres dbname=dapr port=5432
55+
56+
# =============================================================================
57+
# Development Environment
58+
# =============================================================================
59+
# Node.js module path for development tools
60+
NODE_PATH=/opt/node_modules
61+
62+
# npm configuration prefix
63+
npm_config_prefix=/opt/node_modules
64+
65+
# Python cache directory
66+
PYTHONPYCACHEPREFIX=/opt/python-cache/__pycache__
67+
68+
# Pytest cache directory
69+
PYTEST_CACHE_DIR=/opt/pytest-cache
70+
71+
# Mypy cache directory
72+
MYPY_CACHE_DIR=/opt/mypy-cache
73+
74+
# Ruff cache directory
75+
RUFF_CACHE_DIR=/opt/ruff-cache
76+
77+
# =============================================================================
78+
# GPU Configuration (Optional)
79+
# =============================================================================
80+
# GPU support is automatically configured if NVIDIA GPU and drivers are available
81+
# No manual configuration needed - Docker will detect and use available GPUs
82+
# To disable GPU support, comment out the deploy.resources.reservations section
83+
# in docker-compose.yml for app-dev and app-prod services
84+
85+
# =============================================================================
86+
# Notes
87+
# =============================================================================
88+
# - All variables have sensible defaults for local development
89+
# - Only OPENAI_API_KEY is strictly required
90+
# - Variables with ${VAR:-default} syntax in docker-compose.yml will use
91+
# values from this file if set, otherwise use the default
92+
# - Dapr components support environment variable substitution
93+
# - Cache directories are mounted as volumes for performance

.devcontainer/dapr-components/pubsub/redis.yaml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,6 @@ spec:
77
version: v1
88
metadata:
99
- name: redisHost
10-
value: redis:6379
10+
value: "${REDIS_HOST:-redis:6379}"
1111
- name: redisPassword
12-
value: ""
12+
value: "${REDIS_PASSWORD:-}"

.devcontainer/dapr-components/statestore/postgres.yaml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,4 +7,4 @@ spec:
77
version: v2
88
metadata:
99
- name: connectionString
10-
value: "host=postgres user=postgres password=postgres dbname=dapr port=5432"
10+
value: "${POSTGRES_CONNECTION_STRING:-host=postgres user=postgres password=postgres dbname=dapr port=5432}"

.devcontainer/dapr-components/statestore/redis.yaml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -7,8 +7,8 @@ spec:
77
version: v1
88
metadata:
99
- name: redisHost
10-
value: redis:6379
10+
value: "${REDIS_HOST:-redis:6379}"
1111
- name: redisPassword
12-
value: ""
12+
value: "${REDIS_PASSWORD:-}"
1313
- name: actorStateStore
1414
value: "false"

0 commit comments

Comments
 (0)