Conversation
📝 WalkthroughWalkthroughThe PR updates the environment variable loading path in the database configuration file from a relative path referencing 4 parent directories to 5 parent directories. Minor indentation adjustments and a trailing newline are also applied to the file. Changes
Estimated code review effort🎯 1 (Trivial) | ⏱️ ~3 minutes Possibly related PRs
Poem
🚥 Pre-merge checks | ✅ 3✅ Passed checks (3 passed)
✏️ Tip: You can configure your own custom pre-merge checks in the settings. ✨ Finishing Touches
🧪 Generate unit tests (beta)
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. Comment |
There was a problem hiding this comment.
🧹 Nitpick comments (1)
platforms/registry/api/src/config/database.ts (1)
8-8: Consider making root.envlookup configurable to avoid path-depth coupling.Line 8 fixes today’s structure, but the hard-coded
../../../../../.envcan break again if build/output paths change. Consider allowing an override path with fallback.Proposed refactor
-import { join } from "path" +import { join, resolve } from "path" -// Load environment variables from root .env file -dotenv.config({ path: join(__dirname, "../../../../../.env") }) +// Load environment variables from root .env file (override-able) +const envPath = + process.env.REGISTRY_ENV_PATH ?? resolve(__dirname, "../../../../../.env") +dotenv.config({ path: envPath })🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed. In `@platforms/registry/api/src/config/database.ts` at line 8, Replace the hard-coded relative path in the dotenv load call by allowing a configurable override and a safer fallback: read a dedicated env var (e.g. ROOT_ENV_PATH or DOTENV_PATH) first, and if not set, fall back to a robust upward lookup or a path resolved from a single known anchor (use join/__dirname in the current module only as last resort). Update the dotenv.config invocation (the call using dotenv.config and join(__dirname, "...")) to prefer process.env.ROOT_ENV_PATH (or process.env.DOTENV_CONFIG_PATH), then attempt a small upward search or path.resolve-based fallback so changes in build/output nesting won't break loading.
🤖 Prompt for all review comments with AI agents
Verify each finding against the current code and only fix it if needed.
Nitpick comments:
In `@platforms/registry/api/src/config/database.ts`:
- Line 8: Replace the hard-coded relative path in the dotenv load call by
allowing a configurable override and a safer fallback: read a dedicated env var
(e.g. ROOT_ENV_PATH or DOTENV_PATH) first, and if not set, fall back to a robust
upward lookup or a path resolved from a single known anchor (use join/__dirname
in the current module only as last resort). Update the dotenv.config invocation
(the call using dotenv.config and join(__dirname, "...")) to prefer
process.env.ROOT_ENV_PATH (or process.env.DOTENV_CONFIG_PATH), then attempt a
small upward search or path.resolve-based fallback so changes in build/output
nesting won't break loading.
Description of change
fix registry path resolution to env which was broken causing issues, including a heartbreak for me when it stopped working :sadness:
Issue Number
n/a
Type of change
How the change has been tested
Change checklist
Summary by CodeRabbit