Skip to Content
ConfigurationEnvironment variables

Environment variables

Asantiya supports using environment variables stored in a .env file for flexible configuration. Simply create a .env file in the same folder as your Compose/YAML file:

DATABASE_URL=postgres://user:pass@db:5432/mydb

Then reference them in your YAML using interpolation:

environment: - SECRET_KEY=${MY_SECRET_KEY} - DATABASE_URL=${DATABASE_URL} Docker Compose automatically reads the .env file and replaces ${...} placeholders with their corresponding values at runtime. This approach keeps sensitive data out of your code, enhances portability across environments, and allows easy overrides via shell variables or additional .env files
Last updated on