Overview
The devgraph-env block defines environment variables for a service. Variables are associated with a parent service defined by devgraph-service.
Syntax
```devgraph-env
service: my-service
vars:
PORT: "3000"
DATABASE_URL: postgresql://localhost:5432/mydb
NODE_ENV: development
```
Fields
| Field | Required | Description |
|---|
service | Yes | Name of the parent service |
vars | Yes | Object mapping variable names to values |
Examples
Basic environment
```devgraph-env
service: api
vars:
PORT: "3000"
NODE_ENV: development
```
Database configuration
```devgraph-env
service: api
vars:
DATABASE_URL: postgresql://localhost:5432/mydb
DATABASE_POOL_SIZE: "10"
DATABASE_SSL: "false"
```
External services
```devgraph-env
service: api
vars:
REDIS_URL: redis://localhost:6379
AWS_REGION: us-east-1
AWS_S3_BUCKET: my-bucket
```
Multiple env blocks
You can split variables across multiple blocks:
```devgraph-env
service: api
vars:
PORT: "3000"
NODE_ENV: development
```
```devgraph-env
service: api
vars:
DATABASE_URL: postgresql://localhost:5432/mydb
```
Security Note
Do not include actual secrets in devgraph-env blocks. Use placeholder values or descriptions instead. These files are typically committed to version control.
Good:
vars:
API_KEY: "your-api-key-here"
DATABASE_URL: postgresql://user:password@host:5432/db
Bad:
vars:
API_KEY: "sk-live-abc123..." # Never commit real secrets!
Generated Output
Environment variables appear in:
graph.json under the service’s env field
summary.md in the environment table
agents/{service}.md context file