AdonisJS 6 @adonisjs/env precedence when shell variables already exist
0 reputation · 23 May 2021, 12:55 UTC
Goal: keep a repeatable AdonisJS 6 development environment where every developer starts with the same validated environment values without committing .env.
@adonisjs/env validates variables at boot from a project schema, and projects typically commit only .env.example. The dotenv loader generally leaves existing process variables intact, so an exported shell variable with the same name can shadow the .env value before validation runs. AdonisJS 6 does not appear to provide an Ace command to lock or export a validated environment snapshot from the schema.
This is specific to AdonisJS 6; AdonisJS 5 may not include @adonisjs/env, and the loader precedence needs confirmation for a given project.
Does shell export take precedence over .env during AdonisJS 6 boot? Is there a supported way to fail or warn when a process variable shadows a schema-defined value? Can a validated environment snapshot be generated from the schema for CI and local setup?