Skip to content

improve: suppress dotenv startup log message - #3641

Closed
droplet-rl wants to merge 1 commit into
masterfrom
droplet/C0BHMM63D9Q-1785316898-296319
Closed

improve: suppress dotenv startup log message#3641
droplet-rl wants to merge 1 commit into
masterfrom
droplet/C0BHMM63D9Q-1785316898-296319

Conversation

@droplet-rl

Copy link
Copy Markdown
Contributor

Motivation

Every bot startup prints a dotenv advert:

◇ injected env (N) from .env // tip: ◈ secrets for agents [www.dotenvx.com]

What

Sets DOTENV_CONFIG_QUIET=true (unless already set by the operator) as the first statement of the runtime entry point, before any imports run.

Why this shape instead of config({ quiet: true })

The noisy dotenv is not the repo's own — this repo resolves dotenv@16.3.1, which predates the log message entirely (it arrived in 16.6.0). The message comes from @risk-labs/logger, whose Transports.ts calls dotenv.config() with its own nested dotenv@17.4.2 at import time — i.e. before index.ts's own config() call ever executes. So adding { quiet: true } to the repo's config() call would be a no-op on both counts.

The env var is dotenv's documented suppression switch and reaches every dotenv instance in the process, including the logger's. Verified against dotenv@17.4.2: silent with DOTENV_CONFIG_QUIET=true, noisy without. ??= keeps it operator-overridable. Same pattern already used in scripts/buildJussiGraph.ts (#3161); tsconfig targets CommonJS, so the assignment is emitted ahead of the first require.

No doc updates needed (no behavior/config/interface change beyond log noise).

Requested by Paul in Slack: https://risklabs.slack.com/archives/C0BHMM63D9Q/p1785316898296319

🤖 Generated with Claude Code

@risk-labs/logger pulls in dotenv@17, which since v16.6 prints an
'injected env (N) from .env // tip: ...' advert on every startup. The
logger calls dotenv.config() at import time, so the suppression must be
an env var set before any imports run; passing { quiet: true } to the
repo's own config() call would not reach it (and the repo's direct
dotenv dependency is 16.3.1, which never logs). Same pattern as
scripts/buildJussiGraph.ts (#3161).

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
@droplet-rl

Copy link
Copy Markdown
Contributor Author

Closing in favor of the upstream fix in risk-labs/logger#31 — we control the logger, so silencing dotenv at the source covers all consumers. The relayer will pick it up via a @risk-labs/logger version bump once that's released.

@droplet-rl droplet-rl closed this Jul 29, 2026
@droplet-rl
droplet-rl deleted the droplet/C0BHMM63D9Q-1785316898-296319 branch July 29, 2026 09:35
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant