llms.txt

Environment Variables

Environment variables are key-value pairs that configure your application at runtime. They're used for database connections, API keys, feature flags, and other settings that change between environments.

How environment variables work in Hydron

Environment variables in Hydron are:

  • Encrypted at rest — Sensitive values are encrypted with AES-256
  • Injected at runtime — Passed to Docker containers when they start
  • Per-service — Each service has its own set of variables
  • Never logged — Sensitive values are redacted from deployment logs

Setting environment variables

During code analysis

When Hydron analyzes your repository, it detects environment variables referenced in your code. Common patterns it recognizes:

  • process.env.DATABASE_URL (Node.js)
  • os.environ.get('SECRET_KEY') (Python)
  • ENV['REDIS_URL'] (Ruby)
  • .env file references

Detected variables appear in the service configuration with empty values for you to fill in.

Through the chat

Tell the AI to set environment variables:

"Set the DATABASE_URL for api-server to postgres://user:pass@host:5432/mydb"
"Add a STRIPE_SECRET_KEY variable to the payment service"
"Set NODE_ENV to production for all services"

Through the sidebar

  1. Open the Services tab in the right sidebar
  2. Click on a service
  3. Find the Environment Variables section
  4. Add, edit, or remove variables
The Services panel where you can configure environment variables per service

Common environment variables

Here are commonly used environment variables by category:

Application

VariableDescriptionExample
NODE_ENVRuntime environmentproduction
PORTServer listen port3000
HOSTServer bind address0.0.0.0
LOG_LEVELLogging verbosityinfo

Database

VariableDescriptionExample
DATABASE_URLFull connection stringpostgres://user:pass@host:5432/db
DB_HOSTDatabase hostnamepostgres.internal
DB_PORTDatabase port5432
DB_NAMEDatabase namemyapp
DB_USERDatabase usernameapp_user
DB_PASSWORDDatabase password(secret)

Cache & Queue

VariableDescriptionExample
REDIS_URLRedis connection stringredis://redis:6379
CACHE_TTLCache time-to-live3600

Authentication

VariableDescriptionExample
JWT_SECRETToken signing secret(secret)
SESSION_SECRETSession encryption key(secret)
OAUTH_CLIENT_IDOAuth client identifierabc123
OAUTH_CLIENT_SECRETOAuth client secret(secret)

External services

VariableDescriptionExample
STRIPE_SECRET_KEYPayment processingsk_live_...
SMTP_HOSTEmail serversmtp.gmail.com
S3_BUCKETStorage bucket namemy-app-uploads
API_KEYThird-party API key(secret)

Cross-service references

When services within the same project need to communicate, Hydron can automatically configure cross-service environment variables.

For example, if your api-server depends on a postgres service, Hydron sets:

api-server:
  DATABASE_URL = postgres://user:pass@postgres:5432/mydb
                                      ^^^^^^^^
                                      Internal service name

Services within the same deployment can reach each other by their service name as the hostname.

Best practices

  • Never hardcode secrets — Always use environment variables for API keys, passwords, and tokens
  • Use descriptive namesDATABASE_URL is better than DB
  • Group related variables — Use prefixes like SMTP_, AWS_, STRIPE_ for organization
  • Keep defaults sensible — Set non-sensitive defaults where appropriate (ports, log levels)
  • Document required variables — Add descriptions to help team members understand what each variable does

Updating variables after deployment

To update environment variables after your app is deployed:

  1. Change the values through the chat or sidebar
  2. Ask the AI to redeploy the affected service
  3. The container restarts with the new values

Changes to environment variables require a container restart to take effect.