Skip to content

fix: .env path resolution on registry#886

Merged
coodos merged 1 commit intomainfrom
fix/registry-migration-resolution
Feb 26, 2026
Merged

fix: .env path resolution on registry#886
coodos merged 1 commit intomainfrom
fix/registry-migration-resolution

Conversation

@coodos
Copy link
Contributor

@coodos coodos commented Feb 26, 2026

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

  • Fix (a change which fixes an issue)

How the change has been tested

Change checklist

  • I have ensured that the CI Checks pass locally
  • I have removed any unnecessary logic
  • My code is well documented
  • I have signed my commits
  • My code follows the pattern of the application
  • I have self reviewed my code

Summary by CodeRabbit

  • Chores
    • Updated database configuration file path resolution.
    • Applied minor formatting adjustments to configuration code.

@coderabbitai
Copy link
Contributor

coderabbitai bot commented Feb 26, 2026

📝 Walkthrough

Walkthrough

The 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

Cohort / File(s) Summary
Database Configuration Path Update
platforms/registry/api/src/config/database.ts
Updated dotenv config path from ../../../../.env to ../../../../../.env; applied minor formatting adjustments to SSL configuration block indentation; added trailing newline.

Estimated code review effort

🎯 1 (Trivial) | ⏱️ ~3 minutes

Possibly related PRs

Poem

🐰 One path deeper, the rabbit did hop,
From four dots up, to five without stop,
The environment calls from a distant place,
Configuration fixed with elegance and grace! ✨

🚥 Pre-merge checks | ✅ 3
✅ Passed checks (3 passed)
Check name Status Explanation
Title check ✅ Passed The title accurately describes the main change: fixing the .env file path resolution in the registry configuration.
Description check ✅ Passed The description covers required sections but lacks specific details about how the fix was tested and what the broken behavior was.
Docstring Coverage ✅ Passed No functions found in the changed files to evaluate docstring coverage. Skipping docstring coverage check.

✏️ Tip: You can configure your own custom pre-merge checks in the settings.

✨ Finishing Touches
  • 📝 Generate docstrings (stacked PR)
  • 📝 Generate docstrings (commit on current branch)
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Post copyable unit tests in a comment
  • Commit unit tests in branch fix/registry-migration-resolution

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.

❤️ Share

Comment @coderabbitai help to get the list of available commands and usage tips.

Copy link
Contributor

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🧹 Nitpick comments (1)
platforms/registry/api/src/config/database.ts (1)

8-8: Consider making root .env lookup configurable to avoid path-depth coupling.

Line 8 fixes today’s structure, but the hard-coded ../../../../../.env can 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.

ℹ️ Review info

Configuration used: defaults

Review profile: CHILL

Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between e778d73 and 2792672.

📒 Files selected for processing (1)
  • platforms/registry/api/src/config/database.ts

@coodos coodos merged commit 5e96130 into main Feb 26, 2026
5 checks passed
@coodos coodos deleted the fix/registry-migration-resolution branch February 26, 2026 08:21
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.

2 participants