fix: align auth config field names

Co-authored-by: Codex <noreply@openai.com>
This commit is contained in:
Zyy
2026-06-23 18:10:13 +08:00
co-authored by Codex
parent 8e2b2cbdf9
commit b53cb82008
16 changed files with 56 additions and 40 deletions
+6 -4
View File
@@ -81,10 +81,12 @@ pub struct AuthConfig {
pub rotation_strategy: String,
/// 套餐优先级。
pub tier_priority: Vec<String>,
/// Token 续期客户端 ID。
pub token_client_id: String,
/// Token 续期端点。
pub token_endpoint: String,
/// OAuth 客户端 ID。
pub oauth_client_id: String,
/// OAuth 授权端点。
pub oauth_auth_endpoint: String,
/// OAuth token 端点。
pub oauth_token_endpoint: String,
}
/// 配额刷新与跳过配置。
+2 -2
View File
@@ -249,7 +249,7 @@ impl Services {
fn token_client_config(config: &AppConfig) -> TokenClientConfig {
TokenClientConfig {
client_id: config.auth.token_client_id.clone(),
token_endpoint: config.auth.token_endpoint.clone(),
client_id: config.auth.oauth_client_id.clone(),
token_endpoint: config.auth.oauth_token_endpoint.clone(),
}
}
+2 -2
View File
@@ -130,8 +130,8 @@ impl TaskCoordinator {
fn token_client_config(config: &crate::runtime::state::RuntimeConfig) -> TokenClientConfig {
TokenClientConfig {
client_id: config.auth.token_client_id.clone(),
token_endpoint: config.auth.token_endpoint.clone(),
client_id: config.auth.oauth_client_id.clone(),
token_endpoint: config.auth.oauth_token_endpoint.clone(),
}
}
+3 -2
View File
@@ -227,8 +227,9 @@ fn test_config(database_url: String) -> AppConfig {
request_interval_ms: 50,
rotation_strategy: "least_used".to_string(),
tier_priority: Vec::new(),
token_client_id: "app_EMoamEEZ73f0CkXaXp7hrann".to_string(),
token_endpoint: "https://auth.openai.com/oauth/token".to_string(),
oauth_client_id: "app_EMoamEEZ73f0CkXaXp7hrann".to_string(),
oauth_auth_endpoint: "https://auth.openai.com/oauth/authorize".to_string(),
oauth_token_endpoint: "https://auth.openai.com/oauth/token".to_string(),
},
quota: QuotaConfig {
refresh_interval_minutes: 5,
@@ -191,8 +191,9 @@ fn test_config(database_url: String) -> AppConfig {
request_interval_ms: 50,
rotation_strategy: "least_used".to_string(),
tier_priority: vec!["team".to_string(), "plus".to_string()],
token_client_id: "app_EMoamEEZ73f0CkXaXp7hrann".to_string(),
token_endpoint: "https://auth.openai.com/oauth/token".to_string(),
oauth_client_id: "app_EMoamEEZ73f0CkXaXp7hrann".to_string(),
oauth_auth_endpoint: "https://auth.openai.com/oauth/authorize".to_string(),
oauth_token_endpoint: "https://auth.openai.com/oauth/token".to_string(),
},
quota: QuotaConfig {
refresh_interval_minutes: 5,
+3 -2
View File
@@ -134,8 +134,9 @@ fn test_config(database_url: String) -> AppConfig {
request_interval_ms: 50,
rotation_strategy: "least_used".to_string(),
tier_priority: Vec::new(),
token_client_id: "app_EMoamEEZ73f0CkXaXp7hrann".to_string(),
token_endpoint: "https://auth.openai.com/oauth/token".to_string(),
oauth_client_id: "app_EMoamEEZ73f0CkXaXp7hrann".to_string(),
oauth_auth_endpoint: "https://auth.openai.com/oauth/authorize".to_string(),
oauth_token_endpoint: "https://auth.openai.com/oauth/token".to_string(),
},
quota: QuotaConfig {
refresh_interval_minutes: 5,
+3 -2
View File
@@ -226,8 +226,9 @@ fn test_config(database_url: String, base_url: String) -> AppConfig {
request_interval_ms: 50,
rotation_strategy: "least_used".to_string(),
tier_priority: Vec::new(),
token_client_id: "app_EMoamEEZ73f0CkXaXp7hrann".to_string(),
token_endpoint: "https://auth.openai.com/oauth/token".to_string(),
oauth_client_id: "app_EMoamEEZ73f0CkXaXp7hrann".to_string(),
oauth_auth_endpoint: "https://auth.openai.com/oauth/authorize".to_string(),
oauth_token_endpoint: "https://auth.openai.com/oauth/token".to_string(),
},
quota: QuotaConfig {
refresh_interval_minutes: 5,
@@ -296,8 +296,9 @@ fn test_config(database_url: String) -> AppConfig {
request_interval_ms: 50,
rotation_strategy: "least_used".to_string(),
tier_priority: Vec::new(),
token_client_id: "app_EMoamEEZ73f0CkXaXp7hrann".to_string(),
token_endpoint: "https://auth.openai.com/oauth/token".to_string(),
oauth_client_id: "app_EMoamEEZ73f0CkXaXp7hrann".to_string(),
oauth_auth_endpoint: "https://auth.openai.com/oauth/authorize".to_string(),
oauth_token_endpoint: "https://auth.openai.com/oauth/token".to_string(),
},
quota: QuotaConfig {
refresh_interval_minutes: 5,
+3 -2
View File
@@ -329,8 +329,9 @@ fn test_config(database_url: String) -> AppConfig {
request_interval_ms: 50,
rotation_strategy: "least_used".to_string(),
tier_priority: vec!["team".to_string(), "plus".to_string()],
token_client_id: "app_EMoamEEZ73f0CkXaXp7hrann".to_string(),
token_endpoint: "https://auth.openai.com/oauth/token".to_string(),
oauth_client_id: "app_EMoamEEZ73f0CkXaXp7hrann".to_string(),
oauth_auth_endpoint: "https://auth.openai.com/oauth/authorize".to_string(),
oauth_token_endpoint: "https://auth.openai.com/oauth/token".to_string(),
},
quota: QuotaConfig {
refresh_interval_minutes: 5,
+10 -8
View File
@@ -21,8 +21,9 @@ auth:
request_interval_ms: 50
rotation_strategy: least_used
tier_priority: []
token_client_id: app_EMoamEEZ73f0CkXaXp7hrann
token_endpoint: https://auth.openai.com/oauth/token
oauth_client_id: app_EMoamEEZ73f0CkXaXp7hrann
oauth_auth_endpoint: https://auth.openai.com/oauth/authorize
oauth_token_endpoint: https://auth.openai.com/oauth/token
quota:
refresh_interval_minutes: 5
warning_thresholds:
@@ -110,9 +111,9 @@ fn default_config_keeps_only_codex_backend() {
assert_eq!(cfg.model.default_model, "gpt-5.5");
assert_eq!(cfg.auth.refresh_margin_seconds, 300);
assert_eq!(cfg.auth.rotation_strategy, "least_used");
assert_eq!(cfg.auth.token_client_id, "app_EMoamEEZ73f0CkXaXp7hrann");
assert_eq!(cfg.auth.oauth_client_id, "app_EMoamEEZ73f0CkXaXp7hrann");
assert_eq!(
cfg.auth.token_endpoint,
cfg.auth.oauth_token_endpoint,
"https://auth.openai.com/oauth/token"
);
assert!(cfg.ws_pool.enabled);
@@ -163,8 +164,9 @@ auth:
request_interval_ms: 50
rotation_strategy: least_used
tier_priority: []
token_client_id: app_test_client
token_endpoint: https://auth.example.test/oauth/token
oauth_client_id: app_test_client
oauth_auth_endpoint: https://auth.openai.com/oauth/authorize
oauth_token_endpoint: https://auth.example.test/oauth/token
quota:
refresh_interval_minutes: 5
warning_thresholds:
@@ -268,9 +270,9 @@ ws_pool:
);
assert_eq!(cfg.model.default_model, "gpt-5.5");
assert_eq!(cfg.auth.max_concurrent_per_account, 3);
assert_eq!(cfg.auth.token_client_id, "app_test_client");
assert_eq!(cfg.auth.oauth_client_id, "app_test_client");
assert_eq!(
cfg.auth.token_endpoint,
cfg.auth.oauth_token_endpoint,
"https://auth.example.test/oauth/token"
);
assert!(cfg.ws_pool.enabled);
+3 -2
View File
@@ -159,8 +159,9 @@ fn test_config(database_url: String) -> AppConfig {
request_interval_ms: 50,
rotation_strategy: "least_used".to_string(),
tier_priority: Vec::new(),
token_client_id: "app_id".to_string(),
token_endpoint: "https://auth.invalid/token".to_string(),
oauth_client_id: "app_id".to_string(),
oauth_auth_endpoint: "https://auth.openai.com/oauth/authorize".to_string(),
oauth_token_endpoint: "https://auth.invalid/token".to_string(),
},
quota: QuotaConfig {
refresh_interval_minutes: 5,
@@ -1658,8 +1658,9 @@ fn test_config(database_url: String, base_url: String) -> AppConfig {
request_interval_ms: 50,
rotation_strategy: "least_used".to_string(),
tier_priority: Vec::new(),
token_client_id: "app_EMoamEEZ73f0CkXaXp7hrann".to_string(),
token_endpoint: "https://auth.openai.com/oauth/token".to_string(),
oauth_client_id: "app_EMoamEEZ73f0CkXaXp7hrann".to_string(),
oauth_auth_endpoint: "https://auth.openai.com/oauth/authorize".to_string(),
oauth_token_endpoint: "https://auth.openai.com/oauth/token".to_string(),
},
quota: QuotaConfig {
refresh_interval_minutes: 5,
@@ -269,8 +269,9 @@ fn test_config(database_url: String, base_url: String) -> AppConfig {
request_interval_ms: 50,
rotation_strategy: "least_used".to_string(),
tier_priority: Vec::new(),
token_client_id: "app_EMoamEEZ73f0CkXaXp7hrann".to_string(),
token_endpoint: "https://auth.openai.com/oauth/token".to_string(),
oauth_client_id: "app_EMoamEEZ73f0CkXaXp7hrann".to_string(),
oauth_auth_endpoint: "https://auth.openai.com/oauth/authorize".to_string(),
oauth_token_endpoint: "https://auth.openai.com/oauth/token".to_string(),
},
quota: QuotaConfig {
refresh_interval_minutes: 5,
@@ -139,8 +139,9 @@ fn test_config(database_url: String) -> AppConfig {
request_interval_ms: 50,
rotation_strategy: "least_used".to_string(),
tier_priority: Vec::new(),
token_client_id: "app_EMoamEEZ73f0CkXaXp7hrann".to_string(),
token_endpoint: "https://auth.openai.com/oauth/token".to_string(),
oauth_client_id: "app_EMoamEEZ73f0CkXaXp7hrann".to_string(),
oauth_auth_endpoint: "https://auth.openai.com/oauth/authorize".to_string(),
oauth_token_endpoint: "https://auth.openai.com/oauth/token".to_string(),
},
quota: QuotaConfig {
refresh_interval_minutes: 5,
@@ -202,8 +202,9 @@ fn test_config(database_url: String) -> AppConfig {
request_interval_ms: 50,
rotation_strategy: "least_used".to_string(),
tier_priority: Vec::new(),
token_client_id: "app_EMoamEEZ73f0CkXaXp7hrann".to_string(),
token_endpoint: "https://auth.openai.com/oauth/token".to_string(),
oauth_client_id: "app_EMoamEEZ73f0CkXaXp7hrann".to_string(),
oauth_auth_endpoint: "https://auth.openai.com/oauth/authorize".to_string(),
oauth_token_endpoint: "https://auth.openai.com/oauth/token".to_string(),
},
quota: QuotaConfig {
refresh_interval_minutes: 5,
+3 -2
View File
@@ -29,8 +29,9 @@ pub fn test_config(database_url: String) -> AppConfig {
request_interval_ms: 50,
rotation_strategy: "least_used".to_string(),
tier_priority: Vec::new(),
token_client_id: "app_EMoamEEZ73f0CkXaXp7hrann".to_string(),
token_endpoint: "https://auth.openai.com/oauth/token".to_string(),
oauth_client_id: "app_EMoamEEZ73f0CkXaXp7hrann".to_string(),
oauth_auth_endpoint: "https://auth.openai.com/oauth/authorize".to_string(),
oauth_token_endpoint: "https://auth.openai.com/oauth/token".to_string(),
},
quota: QuotaConfig {
refresh_interval_minutes: 5,