mirror of
https://github.com/openai/codex.git
synced 2026-04-27 08:05:51 +00:00
27 lines
683 B
Rust
27 lines
683 B
Rust
use std::path::Path;
|
|
|
|
/// Write a minimal Codex config.toml pointing at the provided mock server URI.
|
|
/// Used by tests that don't exercise approval/sandbox variations.
|
|
pub fn create_config_toml(codex_home: &Path, server_uri: &str) -> std::io::Result<()> {
|
|
let config_toml = codex_home.join("config.toml");
|
|
std::fs::write(
|
|
config_toml,
|
|
format!(
|
|
r#"
|
|
model = "mock-model"
|
|
approval_policy = "never"
|
|
sandbox_mode = "danger-full-access"
|
|
|
|
model_provider = "mock_provider"
|
|
|
|
[model_providers.mock_provider]
|
|
name = "Mock provider for test"
|
|
base_url = "{server_uri}/v1"
|
|
wire_api = "chat"
|
|
request_max_retries = 0
|
|
stream_max_retries = 0
|
|
"#
|
|
),
|
|
)
|
|
}
|