Skip to content

refactor: consolidate CCXRAY_HOME resolution into server/paths.js#52

Merged
lis186 merged 1 commit into
mainfrom
refactor/consolidate-ccxray-home
Jun 6, 2026
Merged

refactor: consolidate CCXRAY_HOME resolution into server/paths.js#52
lis186 merged 1 commit into
mainfrom
refactor/consolidate-ccxray-home

Conversation

@lis186

@lis186 lis186 commented Jun 6, 2026

Copy link
Copy Markdown
Owner

Closes #51. Follow-up to #50.

#50 introduced server/paths.js as the single source of truth for ccxray's on-disk locations, wiring config.js + storage/index.js to it. Four other modules still inlined the same process.env.CCXRAY_HOME || path.join(os.homedir(), '.ccxray') expression.

Change

Replace the inline resolution with resolveCcxrayHome() and drop the now-unused os import in each:

  • server/hub.jsHUB_DIR
  • server/settings.jsSETTINGS_DIR
  • server/ratelimit-log.jsCCXRAY_HOME
  • server/auth.jsgetHubDir() (call kept inside the function, preserving per-call env read)

Plus: refreshed the now-accurate paths.js header comment.

Guarantees

Verification

  • node -c on all 5 touched files; confirmed os fully removed (0 refs) in the 4 consumers.
  • Full suite: 772/772 (hub / settings / auth / ratelimit-log all have existing behavior tests).

Reviewed

Codex (gpt-5.5, xhigh) — no blockers; the one nit (stale paths.js comment) is included in this PR.

Out of scope

S3 banner / legacy-migration regression tests (the other #51 checklist items) — left for a separate change to keep this PR a clean mechanical refactor.

hub.js, settings.js, ratelimit-log.js, and auth.js each inlined the same
'process.env.CCXRAY_HOME || path.join(os.homedir(), ".ccxray")' expression.
Replace all four with resolveCcxrayHome() from server/paths.js (introduced in
#50), and drop the now-unused 'os' import in each. auth.js keeps the call
inside getHubDir() so it still reads the env per call.

Pure de-duplication — identical behavior, no precedence change. The
CCXRAY_HOME contract is now enforced in one place, so it can't drift the way
config.LOGS_DIR did in #31.

Closes #51
@lis186 lis186 merged commit feb8f5b into main Jun 6, 2026
2 checks passed
@lis186 lis186 deleted the refactor/consolidate-ccxray-home branch June 6, 2026 07:09
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.

refactor: consolidate CCXRAY_HOME resolution into server/paths.js

1 participant