claude-code-router icon indicating copy to clipboard operation
claude-code-router copied to clipboard

feat: Allow configuring HOME_DIR via environment variable

Open yanhao98 opened this issue 1 month ago • 1 comments

This change allows users to customize the application's home directory by setting the CLAUDE_CODE_ROUTER_DIR environment variable.

  • Modified src/constants.ts to use path.resolve with the CLAUDE_CODE_ROUTER_DIR environment variable, falling back to the default ~/.claude-code-router if not set.
  • Refactored src/cli.ts, src/server.ts, src/index.ts, src/utils/index.ts, and src/utils/modelSelector.ts to use the centralized HOME_DIR constant, removing hardcoded paths.
  • Updated README.md, README_zh.md, and CLAUDE.md to document this new feature and provide generic examples.
  • Added a comment to docker-compose.yml to show how to use the environment variable.
  • Updated ui/config.example.json to use a generic placeholder path.

yanhao98 avatar Nov 07 '25 13:11 yanhao98

@copilot open a new pull request to apply changes based on the comments in this thread

yanhao98 avatar Nov 07 '25 14:11 yanhao98