Skip to content

Commit 63b7d7d

Browse files
committed
docs: 同步配置说明
1 parent d82d463 commit 63b7d7d

File tree

3 files changed

+59
-35
lines changed

3 files changed

+59
-35
lines changed

.env.example

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -39,7 +39,7 @@ OPENAI_BASE_URL=https://api.openai.com
3939
MAX_CONCURRENT_REQUESTS=100
4040

4141
# 启用 Gzip 压缩
42-
ENABLE_GZIP=false
42+
ENABLE_GZIP=true
4343

4444
# ===========================================
4545
# 日志配置

README.md

Lines changed: 29 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -92,23 +92,35 @@ cp .env.example .env
9292

9393
### Key Configuration Options
9494

95-
| Setting | Environment Variable | Default | Description |
96-
| ----------------------- | ---------------------------------- | ------------------------ | ------------------------------------------------------------------------------------------- |
97-
| Server Port | `PORT` | 3000 | Server listening port |
98-
| Server Host | `HOST` | 0.0.0.0 | Server binding address |
99-
| Keys File | `KEYS_FILE` | keys.txt | API keys file path |
100-
| Start Index | `START_INDEX` | 0 | Starting key index for rotation |
101-
| Blacklist Threshold | `BLACKLIST_THRESHOLD` | 1 | Error count before blacklisting |
102-
| Upstream URL | `OPENAI_BASE_URL` | `https://api.openai.com` | OpenAI-compatible API base URL. Supports multiple, comma-separated URLs for load balancing. |
103-
| Auth Key | `AUTH_KEY` | - | Optional authentication key |
104-
| CORS | `ENABLE_CORS` | true | Enable CORS support |
105-
| Server Read Timeout | `SERVER_READ_TIMEOUT` | 120 | HTTP server read timeout in seconds |
106-
| Server Write Timeout | `SERVER_WRITE_TIMEOUT` | 1800 | HTTP server write timeout in seconds |
107-
| Server Idle Timeout | `SERVER_IDLE_TIMEOUT` | 120 | HTTP server idle timeout in seconds |
108-
| Graceful Shutdown | `SERVER_GRACEFUL_SHUTDOWN_TIMEOUT` | 60 | Graceful shutdown timeout in seconds |
109-
| Request Timeout | `REQUEST_TIMEOUT` | 30 | Request timeout in seconds |
110-
| Response Timeout | `RESPONSE_TIMEOUT` | 30 | Response timeout in seconds (TLS handshake & response header) |
111-
| Idle Connection Timeout | `IDLE_CONN_TIMEOUT` | 120 | Idle connection timeout in seconds |
95+
| Setting | Environment Variable | Default | Description |
96+
| ----------------------- | ---------------------------------- | --------------------------- | ------------------------------------------------------------------------------------------- |
97+
| Server Port | `PORT` | 3000 | Server listening port |
98+
| Server Host | `HOST` | 0.0.0.0 | Server binding address |
99+
| Keys File | `KEYS_FILE` | keys.txt | API keys file path |
100+
| Start Index | `START_INDEX` | 0 | Starting key index for rotation |
101+
| Blacklist Threshold | `BLACKLIST_THRESHOLD` | 1 | Error count before blacklisting |
102+
| Max Retries | `MAX_RETRIES` | 3 | Maximum retry attempts with different keys |
103+
| Upstream URL | `OPENAI_BASE_URL` | `https://api.openai.com` | OpenAI-compatible API base URL. Supports multiple, comma-separated URLs for load balancing. |
104+
| Max Concurrent Requests | `MAX_CONCURRENT_REQUESTS` | 100 | Maximum number of concurrent requests |
105+
| Enable Gzip | `ENABLE_GZIP` | true | Enable Gzip compression for responses |
106+
| Auth Key | `AUTH_KEY` | - | Optional authentication key |
107+
| CORS | `ENABLE_CORS` | true | Enable CORS support |
108+
| Allowed Origins | `ALLOWED_ORIGINS` | \* | CORS allowed origins (comma-separated, \* for all) |
109+
| Allowed Methods | `ALLOWED_METHODS` | GET,POST,PUT,DELETE,OPTIONS | CORS allowed HTTP methods |
110+
| Allowed Headers | `ALLOWED_HEADERS` | \* | CORS allowed headers (comma-separated, \* for all) |
111+
| Allow Credentials | `ALLOW_CREDENTIALS` | false | CORS allow credentials |
112+
| Log Level | `LOG_LEVEL` | info | Logging level (debug, info, warn, error) |
113+
| Log Format | `LOG_FORMAT` | text | Log format (text, json) |
114+
| Enable File Logging | `LOG_ENABLE_FILE` | false | Enable logging to file |
115+
| Log File Path | `LOG_FILE_PATH` | logs/app.log | Log file path |
116+
| Enable Request Logging | `LOG_ENABLE_REQUEST` | true | Enable request logging (set to false in production for performance) |
117+
| Server Read Timeout | `SERVER_READ_TIMEOUT` | 120 | HTTP server read timeout in seconds |
118+
| Server Write Timeout | `SERVER_WRITE_TIMEOUT` | 1800 | HTTP server write timeout in seconds |
119+
| Server Idle Timeout | `SERVER_IDLE_TIMEOUT` | 120 | HTTP server idle timeout in seconds |
120+
| Graceful Shutdown | `SERVER_GRACEFUL_SHUTDOWN_TIMEOUT` | 60 | Graceful shutdown timeout in seconds |
121+
| Request Timeout | `REQUEST_TIMEOUT` | 30 | Request timeout in seconds |
122+
| Response Timeout | `RESPONSE_TIMEOUT` | 30 | Response timeout in seconds (TLS handshake & response header) |
123+
| Idle Connection Timeout | `IDLE_CONN_TIMEOUT` | 120 | Idle connection timeout in seconds |
112124

113125
### Configuration Examples
114126

README_CN.md

Lines changed: 29 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -92,23 +92,35 @@ cp .env.example .env
9292

9393
### 主要配置选项
9494

95-
| 配置项 | 环境变量 | 默认值 | 说明 |
96-
| -------------- | ---------------------------------- | ------------------------ | -------------------------------------------------- |
97-
| 服务器端口 | `PORT` | 3000 | 服务器监听端口 |
98-
| 服务器主机 | `HOST` | 0.0.0.0 | 服务器绑定地址 |
99-
| 密钥文件 | `KEYS_FILE` | keys.txt | API 密钥文件路径 |
100-
| 起始索引 | `START_INDEX` | 0 | 密钥轮换起始索引 |
101-
| 拉黑阈值 | `BLACKLIST_THRESHOLD` | 1 | 拉黑前的错误次数 |
102-
| 上游地址 | `OPENAI_BASE_URL` | `https://api.openai.com` | OpenAI 兼容 API 基础地址。支持多个地址,用逗号分隔 |
103-
| 认证密钥 | `AUTH_KEY` | - | 可选的认证密钥 |
104-
| CORS | `ENABLE_CORS` | true | 启用 CORS 支持 |
105-
| 服务器读取超时 | `SERVER_READ_TIMEOUT` | 120 | HTTP 服务器读取超时时间(秒) |
106-
| 服务器写入超时 | `SERVER_WRITE_TIMEOUT` | 1800 | HTTP 服务器写入超时时间(秒) |
107-
| 服务器空闲超时 | `SERVER_IDLE_TIMEOUT` | 120 | HTTP 服务器空闲超时时间(秒) |
108-
| 优雅关闭超时 | `SERVER_GRACEFUL_SHUTDOWN_TIMEOUT` | 60 | 服务器优雅关闭超时时间(秒) |
109-
| 请求超时 | `REQUEST_TIMEOUT` | 30 | 请求超时时间(秒) |
110-
| 响应超时 | `RESPONSE_TIMEOUT` | 30 | 响应超时时间(秒)- 控制 TLS 握手和响应头接收 |
111-
| 空闲连接超时 | `IDLE_CONN_TIMEOUT` | 120 | 空闲连接超时时间(秒) |
95+
| 配置项 | 环境变量 | 默认值 | 说明 |
96+
| -------------- | ---------------------------------- | --------------------------- | -------------------------------------------------- |
97+
| 服务器端口 | `PORT` | 3000 | 服务器监听端口 |
98+
| 服务器主机 | `HOST` | 0.0.0.0 | 服务器绑定地址 |
99+
| 密钥文件 | `KEYS_FILE` | keys.txt | API 密钥文件路径 |
100+
| 起始索引 | `START_INDEX` | 0 | 密钥轮换起始索引 |
101+
| 拉黑阈值 | `BLACKLIST_THRESHOLD` | 1 | 拉黑前的错误次数 |
102+
| 最大重试次数 | `MAX_RETRIES` | 3 | 使用不同密钥的最大重试次数 |
103+
| 上游地址 | `OPENAI_BASE_URL` | `https://api.openai.com` | OpenAI 兼容 API 基础地址。支持多个地址,用逗号分隔 |
104+
| 最大并发请求数 | `MAX_CONCURRENT_REQUESTS` | 100 | 最大并发请求数 |
105+
| 启用 Gzip 压缩 | `ENABLE_GZIP` | true | 启用响应 Gzip 压缩 |
106+
| 认证密钥 | `AUTH_KEY` | - | 可选的认证密钥 |
107+
| 启用 CORS | `ENABLE_CORS` | true | 启用 CORS 支持 |
108+
| 允许的来源 | `ALLOWED_ORIGINS` | \* | CORS 允许的来源(逗号分隔,\* 表示允许所有) |
109+
| 允许的方法 | `ALLOWED_METHODS` | GET,POST,PUT,DELETE,OPTIONS | CORS 允许的 HTTP 方法 |
110+
| 允许的头部 | `ALLOWED_HEADERS` | \* | CORS 允许的头部(逗号分隔,\* 表示允许所有) |
111+
| 允许凭证 | `ALLOW_CREDENTIALS` | false | CORS 允许凭证 |
112+
| 日志级别 | `LOG_LEVEL` | info | 日志级别(debug, info, warn, error) |
113+
| 日志格式 | `LOG_FORMAT` | text | 日志格式(text, json) |
114+
| 启用文件日志 | `LOG_ENABLE_FILE` | false | 启用文件日志 |
115+
| 日志文件路径 | `LOG_FILE_PATH` | logs/app.log | 日志文件路径 |
116+
| 启用请求日志 | `LOG_ENABLE_REQUEST` | true | 启用请求日志(生产环境可设为 false 以提高性能) |
117+
| 服务器读取超时 | `SERVER_READ_TIMEOUT` | 120 | HTTP 服务器读取超时时间(秒) |
118+
| 服务器写入超时 | `SERVER_WRITE_TIMEOUT` | 1800 | HTTP 服务器写入超时时间(秒) |
119+
| 服务器空闲超时 | `SERVER_IDLE_TIMEOUT` | 120 | HTTP 服务器空闲超时时间(秒) |
120+
| 优雅关闭超时 | `SERVER_GRACEFUL_SHUTDOWN_TIMEOUT` | 60 | 服务器优雅关闭超时时间(秒) |
121+
| 请求超时 | `REQUEST_TIMEOUT` | 30 | 请求超时时间(秒) |
122+
| 响应超时 | `RESPONSE_TIMEOUT` | 30 | 响应超时时间(秒)- 控制 TLS 握手和响应头接收 |
123+
| 空闲连接超时 | `IDLE_CONN_TIMEOUT` | 120 | 空闲连接超时时间(秒) |
112124

113125
### 配置示例
114126

0 commit comments

Comments
 (0)