product:env
Generate or merge .env files for the active product (and optionally its features).
Table of contents
Development environment
Used during local development.
Generate .env for the product
splent product:env --generate --dev
It creates this file.
<product>/docker/.env
From these templates.
.env.dev.example(preferred).env.example
Generate .env for product and all features
splent product:env --generate --all --dev
This does the following.
- Generates the product
.env - Generates
.envfor every declared feature
Internally it calls the following.
splent feature:env <feature> --generate --dev
Merge feature variables into product .env
splent product:env --merge --dev
This command does the following.
- Loads the product
.env - Forces
SPLENT_ENVto match the target environment (devorprod) - Reads
.envfiles from all features - Resolves
__FEATURE_HOST_DIR__placeholders in each feature’s.envfile to the real host path (so Docker Compose bind mounts work correctly) - Adds missing variables to the product
.env - Resolves
__PRODUCT__placeholders in the merged output to the actual product name
Product variables (other than SPLENT_ENV) are never overridden.
Values with spaces are quoted
A generated value containing whitespace or # is written double-quoted
(ABOUT_NAV_LABEL="Quiénes somos"). Unquoted, a shell sourcing the file
stops right there and silently drops every variable after that line, while
docker compose and python-dotenv strip the quotes the same way the shell
does. Plain values stay bare, so existing files do not churn.
Production environment
Used for deployment environments.
Generate .env for the product
splent product:env --generate --prod
It creates this file.
<product>/docker/.env
From these templates.
.env.prod.example(preferred).env.example
Generate .env for product and features
splent product:env --generate --all --prod
Generates .env for the following.
- the product
- every declared feature
Merge feature variables into the product .env
splent product:env --merge --prod
The merge process.
- Uses the product
.envas the base - Forces
SPLENT_ENV=prodin the merged output - Reads
.envfiles from features - Resolves
__FEATURE_HOST_DIR__in each feature’s.envto the real host path - Adds missing keys to the product
.env - Resolves
__PRODUCT__placeholders to the actual product name - Adjusts feature port variables to avoid collisions (see below)
Existing product variables (other than SPLENT_ENV) remain unchanged.
Port offset (automatic port adjustment)
When merging feature .env files, SPLENT adds a product-specific offset to port variables to prevent collisions between multiple products running on the same host.
For full details, examples, and rules for feature authors, see Port offset.
Requirements
- A product must be selected.
splent product:select <product>
- The product must contain the following.
pyproject.toml
docker/