mirror of
https://github.com/openai/codex.git
synced 2026-11-27 23:31:09 +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:
1 parent
09f47c8785
commit
34ecac1f2b
19 files changed
+283
-6
No files matched your search
@@ -41,6 +41,8 @@ impl From<LoaderOverrides> for ConfigLoadOptions {
|
||||
/// LoaderOverrides overrides managed configuration inputs (primarily for tests).
|
||||
#[derive(Debug, Default, Clone)]
|
||||
pub struct LoaderOverrides {
|
||||
/// Optional configuration file supplied with the installed Codex package.
|
||||
pub packaged_defaults_path: Option<AbsolutePathBuf>,
|
||||
pub user_config_path: Option<AbsolutePathBuf>,
|
||||
pub user_config_profile: Option<ProfileV2Name>,
|
||||
pub managed_config_path: Option<PathBuf>,
|
||||
@@ -64,6 +66,7 @@ impl LoaderOverrides {
|
||||
pub fn without_managed_config_for_tests() -> Self {
|
||||
let base = std::env::temp_dir().join("codex-config-tests");
|
||||
Self {
|
||||
packaged_defaults_path: None,
|
||||
user_config_path: None,
|
||||
user_config_profile: None,
|
||||
managed_config_path: Some(base.join("managed_config.toml")),
|
||||
@@ -212,6 +215,7 @@ impl ConfigLayerEntry {
|
||||
// Get the `.codex/` folder associated with this config layer, if any.
|
||||
pub fn config_folder(&self) -> Option<AbsolutePathBuf> {
|
||||
match &self.name {
|
||||
ConfigLayerSource::PackagedDefaults { .. } => None,
|
||||
ConfigLayerSource::Mdm { .. } => None,
|
||||
ConfigLayerSource::System { file } => file.parent(),
|
||||
ConfigLayerSource::EnterpriseManaged { .. } => None,
|
||||
|
||||
Reference in new issue
Block a user