product:env

Generate or merge .env files for the active product (and optionally its features).

Table of contents

  1. Development environment
    1. Generate .env for the product
    2. Generate .env for product and all features
    3. Merge feature variables into product .env
  2. Production environment
    1. Generate .env for the product
    2. Generate .env for product and features
    3. Merge feature variables into the product .env
    4. Port offset (automatic port adjustment)
  3. Requirements

Development environment

Used during local development.

Generate .env for the product

splent product:env --generate --dev

Creates:

<product>/docker/.env

From:

  • .env.dev.example (preferred)
  • .env.example

Generate .env for product and all features

splent product:env --generate --all --dev

This:

  1. Generates the product .env
  2. Generates .env for every declared feature

Internally calls:

splent feature:env <feature> --generate --dev

Merge feature variables into product .env

splent product:env --merge --dev

This command:

  • Loads the product .env
  • Forces SPLENT_ENV to match the target environment (dev or prod)
  • Reads .env files from all features
  • Resolves __FEATURE_HOST_DIR__ placeholders in each feature’s .env file 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.


Production environment

Used for deployment environments.

Generate .env for the product

splent product:env --generate --prod

Creates:

<product>/docker/.env

From:

  • .env.prod.example (preferred)
  • .env.example

Generate .env for product and features

splent product:env --generate --all --prod

Generates .env for:

  • the product
  • every declared feature

Merge feature variables into the product .env

splent product:env --merge --prod

The merge process:

  1. Uses the product .env as the base
  2. Forces SPLENT_ENV=prod in the merged output
  3. Reads .env files from features
  4. Resolves __FEATURE_HOST_DIR__ in each feature’s .env to the real host path
  5. Adds missing keys to the product .env
  6. Resolves __PRODUCT__ placeholders to the actual product name
  7. 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:
pyproject.toml
docker/

Back to top

splent. Distributed by an LGPL license v3. Contact us: drorganvidez@us.es