Skip to content

Commit f5c6125

Browse files
committed
Fix read credentials for ccm service
1 parent 75d4e0c commit f5c6125

File tree

3 files changed

+9
-2
lines changed

3 files changed

+9
-2
lines changed

docs/configuration/service/ccm.md

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -37,7 +37,9 @@ See [Listen Fields](/configuration/shared/listen/) for details.
3737

3838
Path to the Claude Code OAuth credentials file.
3939

40-
Defaults to `~/.claude/.credentials.json` if not specified.
40+
If not specified, defaults to:
41+
- `$CLAUDE_CONFIG_DIR/.credentials.json` if `CLAUDE_CONFIG_DIR` environment variable is set
42+
- `~/.claude/.credentials.json` otherwise
4143

4244
On macOS, credentials are read from the system keychain first, then fall back to the file if unavailable.
4345

docs/configuration/service/ccm.zh.md

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -37,7 +37,9 @@ CCM(Claude Code 多路复用器)服务是一个多路复用服务,允许
3737

3838
Claude Code OAuth 凭据文件的路径。
3939

40-
如果未指定,默认使用 `~/.claude/.credentials.json`
40+
如果未指定,默认值为:
41+
- 如果设置了 `CLAUDE_CONFIG_DIR` 环境变量,则使用 `$CLAUDE_CONFIG_DIR/.credentials.json`
42+
- 否则使用 `~/.claude/.credentials.json`
4143

4244
在 macOS 上,首先从系统钥匙串读取凭据,如果不可用则回退到文件。
4345

service/ccm/credential.go

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -32,6 +32,9 @@ func getRealUser() (*user.User, error) {
3232
}
3333

3434
func getDefaultCredentialsPath() (string, error) {
35+
if configDir := os.Getenv("CLAUDE_CONFIG_DIR"); configDir != "" {
36+
return filepath.Join(configDir, ".credentials.json"), nil
37+
}
3538
userInfo, err := getRealUser()
3639
if err != nil {
3740
return "", err

0 commit comments

Comments
 (0)