Repository navigation
chore(deps): bump dotenv to 18.0.5 - #16
Merged
Merged
Conversation
Move every workspace from dotenv 16.6.1 to 18.0.5. Since 17.0.0, config() logs an "injected env" line unless quiet is set, and 18 prints it to stderr. Pass quiet: true to the two explicit config() calls (server entry and esbuild config) so startup and build output stay unchanged. dotenv/config sets quiet: true itself since 18.0.4, so the `-r dotenv/config` scripts and `import "dotenv/config"` entries stay silent. The 18.0.0 "removed preloading" entry drops the dotenv_config_* argv options of dotenv/config. The module itself still exists and loads .env from the cwd with the same regex parser and no-override populate, so the `-r dotenv/config` scripts keep working unchanged. 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.
What changed
dotenv16.6.1 → 18.0.5 in every workspace: root devDependency,apps/dokploy,packages/server(exact pins),apps/apiandapps/schedules(^18.0.5).bun.lockonly changes the top-leveldotenventry; the nested 17.4.2 copies used by@dotenvx/dotenvxandauthare untouched.apps/dokploy/server/server.tsandapps/dokploy/esbuild.config.ts: the explicitconfig()calls now passquiet: true.node -r dotenv/config …,tsx -r dotenv/config …andimport "dotenv/config"stay as they are (see below).Release notes that matter here
quietdefaults tofalse, soconfig()printsinjected env (N) from .env..env.vaultsupport and "preloading" are removed; newdotenv run -- cmdCLI and an opt-in fast parser (fast: true). The default parser is still the classic regex parser.dotenv/configdefaults toquiet: true.Why
-r dotenv/configstaysThe 18.0.0 changelog line "Removed preloading; use
dotenv run" sounds likenode -r dotenv/configstops working. It does not. I read the published 18.0.5 package:exports["./config"]still points todist/config.cjs, a CommonJS side-effect module, so both-r dotenv/configandimport "dotenv/config"resolve.node -r dotenv/config app.js dotenv_config_path=…, the oldlib/cli-options.js). We never pass those arguments.dist/config.cjscallsconfig({ quiet: true })unlessDOTENV_QUIET/DOTENV_CONFIG_QUIETis set. The README still describes it this way: "dotenv/configimports and preloads default totrue".parse()withoutfastuses the sameLINEregex and the same unquote/\nexpansion as 16.6.1.populate()still skips keys that are already inprocess.envunlessoverrideis set. A missing.envis still reported in the return value, not thrown.I compared the candidates on a fixture
.envwith plain,export, single/double/backtick quotes,#inside and after values, multiline double and single quotes, escaped\",KEY: value, duplicate keys, an empty value and a key that is also set in the shell:-r dotenv/config-r dotenv/configdotenv run -q ----env-file-if-exists=.envESCQ="say \"hi\""becomessay \, andKEY: valuelines are droppedIn all three, the existing shell variable won over
.env. Keeping-r dotenv/configis the only option that matches 16.6.1 exactly and keeps the process tree under tini the same (bun → sh → node). Node's native loader parses some values differently, so switching to it could quietly change values in.env.production.dotenv runwould add a process and new signal handling aroundnode dist/server.mjs.One small new behaviour in 18:
config()now also readsDOTENV_PATH/DOTENV_OVERRIDE/DOTENV_DEBUG/DOTENV_ENCODING/DOTENV_FAST(plus theDOTENV_CONFIG_*fallbacks) from the environment. Explicit options win. None of these are set in our images.Verification
bun run typecheck: all 4 workspaces pass.__test__/env/*,deploy/env-file-literals-dockerfile,compose/env-file-literals,compose/env-file-preserved): 15 files, 180 tests pass.apps/dokployvitest run: 2052 passed, 10 failed. All 10 failures are timeouts or real-Docker tests. The machine was heavily loaded (load average ~47, other suites running in parallel):application.real.test.ts(5) needs real Docker builds and is expected to fail locally.better-auth-schema-compat,cloud-queue-availability,listen-deployment-boundaryanddb-backup-restore-injectionhit 5 s/10 s timeouts. Rerun with--testTimeout/--hookTimeout=120000: 4 files, 32/32 pass.compose/env-file-literalshit its 60 s timeout during the full run but passed in the targeted env run above.bunx biome checkon the changed files is clean.dist/withbun run build-server(no injected-env line during the build) and ran it from a Docker-like layout (dist/, hoistednode_modules/,package.json, a temp.env):bun run wait-for-postgres(the image's first CMD step) usedDATABASE_URL,POSTGRES_WAIT_TIMEOUTandPOSTGRES_WAIT_RETRYfrom.env.DATABASE_URLset in the shell, the shell value won over.env..envat all it started normally and used the shell value.bun run start:migration.mjsconnected to the host from.env(ENOTFOUNDon the fake host) and the&&chain stopped there as before.tsx -r dotenv/config(dev scripts) loaded.env, and the shell value won.injected envline.Manual check on dev
◇ injected envline, and that the app reaches Postgres, which shows that.env(copied from.env.production) was loaded.import "dotenv/config").next buildlocally; CI covers it.🤖 Generated with Claude Code