make env-check

Introduction

make env-check validates the workspace .env and changes nothing. Run it when something about the environment feels off and you want the full report without starting a container.

make env-check
🩺 SPLENT .env check  (/home/me/splent_workspace/.env)

  [✖] Duplicate variable 'SPLENT_FORGE_TOKEN' (lines 18, 19), last one silently wins.
      Remove the redundant line(s); keep a single definition per key.
  [✔] No malformed lines
  [⚠] SPLENT_HOST_PROJECT_DIR is stale (breaks product bind-mounts):
        in .env  : /old/path
        expected : /home/me/splent_workspace
      Repair it with: make fix-workdir
  [✔] WORKING_DIR = /workspace
  [✔] SPLENT_APP unset (detached mode)
  [✔] No drift versus .env.example

❌ .env has problems, resolve the items above.

It exits 1 when a check fails, and 0 otherwise, warnings included.


What it checks

Check Severity Meaning
Duplicate variables Fail A key is defined more than once. The last one wins
Malformed lines Fail A line that is not blank, a #comment or KEY=value. Leading spaces and an export prefix are fine. A key takes letters, digits and underscores only, so DB HOST=db and KEY = value are malformed
Missing .env Fail The workspace .env does not exist. The pre-flight only prints an info line for it
Unreadable .env Fail The file exists but cannot be read (Cannot read <path>.)
Stale SPLENT_HOST_PROJECT_DIR Warning The host path is unset or does not match the real workspace folder
Missing or wrong WORKING_DIR Warning It must be /workspace
Dangling SPLENT_APP Warning It names a product folder that does not exist
Drift from .env.example Warning Keys the template has and .env lacks, or keys the template does not know

A few keys pass even though the template leaves them out. They are SPLENT_HOST_PROJECT_DIR, SPLENT_APP, SPLENT_ENV, GITHUB_USER, GITHUB_TOKEN, SPLENT_FORGE_KIND, DOCKERHUB_USERNAME, DOCKERHUB_PASSWORD, PYPI_USERNAME and PYPI_PASSWORD. SPLENT_MARKETPLACE_TOKEN is reported, since it never belongs in .env.

The pre-flight of make setup and make docker-up runs the same checks. Inside the container, splent check:env checks tool versions and credentials too, but it cannot see the host path.


See also


Back to top

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