mirror of
https://github.com/openai/codex.git
synced 2026-04-26 15:45:02 +00:00
Add openai_base_url config override for built-in provider (#12031)
We regularly get bug reports from users who mistakenly have the `OPENAI_BASE_URL` environment variable set. This PR deprecates this environment variable in favor of a top-level config key `openai_base_url` that is used for the same purpose. By making it a config key, it will be more visible to users. It will also participate in all of the infrastructure we've added for layered and managed configs. Summary - introduce the `openai_base_url` top-level config key, update schema/tests, and route the built-in openai provider through it while - fall back to deprecated `OPENAI_BASE_URL` env var but warn user of deprecation when no `openai_base_url` config key is present - update CLI, SDK, and TUI code to prefer the new config path (with a deprecated env-var fallback) and document the SDK behavior change
This commit is contained in:
@@ -502,7 +502,7 @@ describe("Codex", () => {
|
||||
],
|
||||
});
|
||||
|
||||
const { envs: spawnEnvs, restore } = codexExecSpy();
|
||||
const { args: spawnArgs, envs: spawnEnvs, restore } = codexExecSpy();
|
||||
process.env.CODEX_ENV_SHOULD_NOT_LEAK = "leak";
|
||||
|
||||
try {
|
||||
@@ -521,11 +521,18 @@ describe("Codex", () => {
|
||||
if (!spawnEnv) {
|
||||
throw new Error("Spawn env missing");
|
||||
}
|
||||
const commandArgs = spawnArgs[0];
|
||||
expect(commandArgs).toBeDefined();
|
||||
if (!commandArgs) {
|
||||
throw new Error("Command args missing");
|
||||
}
|
||||
expect(spawnEnv.CUSTOM_ENV).toBe("custom");
|
||||
expect(spawnEnv.CODEX_ENV_SHOULD_NOT_LEAK).toBeUndefined();
|
||||
expect(spawnEnv.OPENAI_BASE_URL).toBe(url);
|
||||
expect(spawnEnv.OPENAI_BASE_URL).toBeUndefined();
|
||||
expect(spawnEnv.CODEX_API_KEY).toBe("test");
|
||||
expect(spawnEnv.CODEX_INTERNAL_ORIGINATOR_OVERRIDE).toBeDefined();
|
||||
expect(commandArgs).toContain("--config");
|
||||
expect(commandArgs).toContain(`openai_base_url=${JSON.stringify(url)}`);
|
||||
} finally {
|
||||
delete process.env.CODEX_ENV_SHOULD_NOT_LEAK;
|
||||
restore();
|
||||
|
||||
Reference in New Issue
Block a user