discover command scans your source code for environment variable usage and suggests additions to your .preflight.yaml schema. This is the fastest way to sync your configuration with your code.
Usage
Options
| Option | Description |
|---|---|
-s, --schema <path> | Path to your existing schema file |
--fix | Automatically add discovered variables to the schema |
How it works
Preflight performs a static analysis of your source code to find common patterns of environment variable access:- JavaScript/TypeScript:
process.env.VARorprocess.env['VAR'] - Python:
os.environ.get("VAR")oros.getenv("VAR") - Go:
os.Getenv("VAR")
Automatic Syncing
If you run with the--fix flag, Preflight will append any missing variables to your .preflight.yaml with a default type of string and a description indicating it was discovered in the code.
[!TIP]
Run discover --fix as part of your local pre-commit hook or developer setup script to ensure the environment schema never drifts from the codebase.