Skip to content

Commit aa5efff

Browse files
refactor: 将环境变量 GITLAB_HOST 重命名为 GITLAB_URL
- 更新代码中的环境变量读取逻辑 - 更新所有文档中的示例代码 - 保持与常见命名约定一致
1 parent e45442f commit aa5efff

File tree

4 files changed

+8
-8
lines changed

4 files changed

+8
-8
lines changed

README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -38,7 +38,7 @@ make install
3838

3939
```bash
4040
# 设置环境变量(可选)
41-
export GITLAB_HOST=https://your-gitlab-instance.com
41+
export GITLAB_URL=https://your-gitlab-instance.com
4242
export GITLAB_TOKEN=your-personal-access-token
4343

4444
# 创建用户、组和项目

docs/QUICKSTART.md

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@ make build
1515

1616
```bash
1717
# 设置环境变量
18-
export GITLAB_HOST=https://gitlab.example.com
18+
export GITLAB_URL=https://gitlab.example.com
1919
export GITLAB_TOKEN=glpat-your-token-here
2020
```
2121

@@ -83,7 +83,7 @@ users:
8383
#!/bin/bash
8484

8585
# 1. 设置环境变量
86-
export GITLAB_HOST="${CI_GITLAB_HOST}"
86+
export GITLAB_URL="${CI_GITLAB_HOST}"
8787
export GITLAB_TOKEN="${CI_GITLAB_ADMIN_TOKEN}"
8888

8989
# 2. 构建工具
@@ -105,7 +105,7 @@ make build
105105
#!/bin/bash
106106

107107
# 开发环境配置
108-
export GITLAB_HOST=https://dev-gitlab.company.com
108+
export GITLAB_URL=https://dev-gitlab.company.com
109109
export GITLAB_TOKEN=$(cat ~/.gitlab-admin-token)
110110

111111
# 构建最新版本

docs/README.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -32,7 +32,7 @@ go build -o bin/gitlab-cli ./cmd/gitlab-cli
3232
### 2. 配置环境变量
3333

3434
```bash
35-
export GITLAB_HOST=https://gitlab.example.com
35+
export GITLAB_URL=https://gitlab.example.com
3636
export GITLAB_TOKEN=glpat-your-token-here
3737
```
3838

@@ -178,7 +178,7 @@ gitlab-cli-sdk/
178178
#!/bin/bash
179179
180180
# 设置环境变量
181-
export GITLAB_HOST="${CI_GITLAB_HOST}"
181+
export GITLAB_URL="${CI_GITLAB_HOST}"
182182
export GITLAB_TOKEN="${CI_GITLAB_ADMIN_TOKEN}"
183183
184184
# 构建工具

internal/config/config.go

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -20,9 +20,9 @@ type CLIConfig struct {
2020
// LoadGitLabCredentials 从环境变量或命令行参数加载 GitLab 凭证
2121
func LoadGitLabCredentials(cfg *CLIConfig) error {
2222
if cfg.GitLabHost == "" {
23-
cfg.GitLabHost = os.Getenv("GITLAB_HOST")
23+
cfg.GitLabHost = os.Getenv("GITLAB_URL")
2424
if cfg.GitLabHost == "" {
25-
return fmt.Errorf("GitLab host is required (use --host or GITLAB_HOST env)")
25+
return fmt.Errorf("GitLab host is required (use --host or GITLAB_URL env)")
2626
}
2727
}
2828
if cfg.GitLabToken == "" {

0 commit comments

Comments
 (0)