Repository navigation
Conversation
cnpmcore reads about 80 environment variables, and only the config code says which ones exist. `.env.schema` now declares each of them with its type, a short description, and whether it is sensitive. The config files keep their defaults, so every item is optional, and production still reads the deployment environment. For local development, values go to `.env.local`. The dev, test, and coverage scripts, and the database preparation scripts before them, run through `vp dotenv exec`, which validates the values and loads the file. CI checks the schema with `vp dotenv check`, and the pre-commit hook scans staged files for sensitive values. This draft uses a Vite+ preview build (0.0.0-commit.a82db6d) and installs it through the preview registry in CI. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Contributor
|
Important Draft PR not reviewedDraft PRs are not automatically reviewed by default.
To automatically review draft PRs, update your CodeRabbit configuration: reviews:
auto_review:
drafts: true
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. |
|
Review the following changes in direct dependencies. Learn more about Socket for GitHub.
|
utoo reads UTOO_REGISTRY, not npm_config_registry, so the install still resolved vite-plus from its default registry and found no preview build. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## master #1225 +/- ##
==========================================
- Coverage 94.50% 94.36% -0.15%
==========================================
Files 212 212
Lines 9071 9071
Branches 1789 1813 +24
==========================================
- Hits 8573 8560 -13
- Misses 498 511 +13 ☔ View full report in Codecov by Harness. 🚀 New features to boost your workflow:
|
The test jobs call egg-bin and the database scripts directly, not through the npm scripts, so they skipped `vp dotenv exec`. Run them through it, so CI validates its CNPMCORE_* values against .env.schema before the tests. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
The database step runs in the background right after checkout, before the install, so node_modules/.bin/vp does not exist yet. Only the test step, which runs after the install, goes through vp dotenv exec. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This preview counts every declared item in `vp dotenv check`, and `vp dotenv init` keeps a server schema public by default. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
A draft that tries the experimental
vp dotenvsupport from a Vite+ preview build (0.0.0-commit.74cb686) on cnpmcore. The runtime does not change: the config files keep their defaults and still readprocess.env, and production keeps its deployment environment.Changes
.env.schemadeclares the environment variables that cnpmcore reads (registry and sync, features, Elasticsearch, database, Redis, storage, logs, secrets), plus the Docker Compose variables for Elasticsearch. Each item has a type such asboolean,port,url, or an enum (CNPMCORE_DATABASE_TYPE,CNPMCORE_CONFIG_SYNC_MODE,CNPMCORE_NFS_TYPE). Passwords, cloud keys,CNPMCORE_EGG_KEYS, andGITHUB_TOKENare@sensitive. Every item is optional, so the defaults in the config files still apply..env.local, which.gitignorenow ignores.dev,test:local,cov, their PostgreSQL variants, and the database preparation scripts before them run throughvp dotenv exec --, which validates the values and loads the file.startdoes not change.npm run env:check(vp dotenv check) runs in the typecheck job, and the MySQL and PostgreSQL test steps runegg-bin covthroughvp dotenv exec --, so CI validates itsCNPMCORE_*values before the tests. The database preparation steps stay as they are, because they start in the background before the install. The pre-commit hook runsvp dotenv scan --staged.DEVELOPER.mddescribes.env.local,vp dotenv check,print, andexplain..env.examplekeeps only the variables that Docker Compose reads for Elasticsearch.Behavior
vp dotenv checkwithout.env.localFound no errors in 83 config items (0 have a value)CNPMCORE_DATABASE_TYPE=PostgresCurrent value is not in list of possible values, with the allowed values and the source (process.env)vp dotenv printCNPMCORE_DATABASE_PASSWORDshows as's3▒▒▒▒▒'vp dotenv explain CNPMCORE_REDIS_PORTport, value6380as a number, source.env.localvp dotenv exec -- node -e ....env.localreachprocess.env; unset items stayundefined, so config defaults applyvp dotenv execinto a pipevp dotenv scanvp dotenv execPOSTGRES_PASSWORD=postgresis sensitive, sovp dotenv execmasks everypostgresin the log, for example"dialect":"po▒▒▒▒▒"Notes for Vite+:
postgresalso hides unrelated words in logs.vp dotenv checkcounted only the values that are set (0 config itemswithout.env.local). It now counts the declared items and the items with a value.vp dotenv initwrote a header for a Vite client app, which marks every variable without aVITE_prefix sensitive and adds an unusedAPP_ENV. For a project that does not run Vite, it now keeps@defaultSensitive=falseand adds noAPP_ENV. It also adapts a header without a# ---divider, whichvarlock initwrites from this.env.example. The schema in this PR stays written by hand.Before merging
UTOO_REGISTRYandnpm_config_registryto the preview registry (utoo reads onlyUTOO_REGISTRY), andpackage.jsonpins the previewvite-plusandvite-plus-core. Both go back to npm releases before this leaves draft.registry.npmjs.org, which does not have the preview build.🤖 Generated with Claude Code