mirror of
https://github.com/openai/codex.git
synced 2026-10-23 18:08:45 +00:00
Support packaged defaults in config layering (#37810)
## What changed - Load an optional package-supplied config file as the lowest-precedence configuration layer, so every existing layer can override its values. - Report the layer as `packagedDefaults`, including its source path, through config diagnostics and the app-server protocol. - Return an error when a configured packaged defaults file is missing. ## Testing - Cover precedence across packaged, system, user, and session layers. - Cover the missing-file error path. GitOrigin-RevId: 52406890f4d580eedabc90bf2a9ee3affa36fee1
This commit is contained in:
@@ -27,6 +27,14 @@ use std::path::PathBuf;
|
||||
#[ts(tag = "type")]
|
||||
#[ts(export_to = "v2/")]
|
||||
pub enum ConfigLayerSource {
|
||||
/// Default configuration supplied with the installed Codex package.
|
||||
#[serde(rename_all = "camelCase")]
|
||||
#[ts(rename_all = "camelCase")]
|
||||
PackagedDefaults {
|
||||
/// Path to the packaged default configuration file.
|
||||
file: AbsolutePathBuf,
|
||||
},
|
||||
|
||||
/// Managed preferences layer delivered by MDM (macOS only).
|
||||
#[serde(rename_all = "camelCase")]
|
||||
#[ts(rename_all = "camelCase")]
|
||||
@@ -102,6 +110,7 @@ impl ConfigLayerSource {
|
||||
/// from a layer with a lower precedence.
|
||||
pub fn precedence(&self) -> i16 {
|
||||
match self {
|
||||
ConfigLayerSource::PackagedDefaults { .. } => -10,
|
||||
ConfigLayerSource::Mdm { .. } => 0,
|
||||
ConfigLayerSource::System { .. } => 10,
|
||||
ConfigLayerSource::EnterpriseManaged { .. } => 15,
|
||||
|
||||
Reference in New Issue
Block a user