mirror of
https://github.com/facebook/sapling.git
synced 2024-10-04 13:57:13 +03:00
config: fix unix_socket_path input to dynamic config generation
Summary: D56592499 accidentially changed the order of things so load_dynamic never got a auth_proxy.unix_socket_path (since `self` is now empty). Fix by generating and inserting the dynamic config later. This way, auth_proxy.unix_socket_path can be configured anywhere (except for the dynamic config). Reviewed By: quark-zju, sggutier Differential Revision: D56942632 fbshipit-source-id: c98e616993b03374667702552d3c07be00ffdb95
This commit is contained in:
parent
63c7b55c57
commit
f7512e11b9
@ -352,22 +352,7 @@ impl ConfigSetHgExt for ConfigSet {
|
||||
|
||||
let mut layers = crate::builtin_static::builtin_system(opts.clone(), &ident, info);
|
||||
|
||||
// This is the out-of-orderness. We load the dynamic config on a
|
||||
// detached ConfigSet then combine it into our "secondary" config
|
||||
// sources to maintain the correct priority.
|
||||
#[cfg(feature = "fb")]
|
||||
{
|
||||
let dynamic = load_dynamic(
|
||||
info,
|
||||
opts.clone(),
|
||||
&ident,
|
||||
self.get_opt("auth_proxy", "unix_socket_path")
|
||||
.unwrap_or_default(),
|
||||
&mut errors,
|
||||
)
|
||||
.map_err(|e| Errors(vec![Error::Other(e)]))?;
|
||||
layers.push(Arc::new(dynamic));
|
||||
}
|
||||
let dynamic_layer_idx = layers.len();
|
||||
|
||||
let mut system = ConfigSet::new().named("system");
|
||||
errors.append(&mut system.load_system(opts.clone(), &ident));
|
||||
@ -392,13 +377,28 @@ impl ConfigSetHgExt for ConfigSet {
|
||||
layers.push(Arc::new(repo_git));
|
||||
}
|
||||
let mut local = ConfigSet::new().named("repo");
|
||||
errors.append(&mut local.load_repo(info, opts));
|
||||
errors.append(&mut local.load_repo(info, opts.clone()));
|
||||
layers.push(Arc::new(local));
|
||||
if let Err(e) = read_set_repo_name(&layers, self, &info.dot_hg_path) {
|
||||
errors.push(e);
|
||||
}
|
||||
}
|
||||
|
||||
#[cfg(feature = "fb")]
|
||||
{
|
||||
let dynamic = load_dynamic(
|
||||
info,
|
||||
opts,
|
||||
&ident,
|
||||
layers
|
||||
.get_opt("auth_proxy", "unix_socket_path")
|
||||
.unwrap_or_default(),
|
||||
&mut errors,
|
||||
)
|
||||
.map_err(|e| Errors(vec![Error::Other(e)]))?;
|
||||
layers.insert(dynamic_layer_idx, Arc::new(dynamic));
|
||||
}
|
||||
|
||||
self.secondary(Arc::new(layers));
|
||||
|
||||
// Wait until config is fully loaded so maybe_refresh_dynamic() itself sees
|
||||
|
@ -50,6 +50,17 @@ impl UnionConfig {
|
||||
pub fn push(&mut self, config: Arc<dyn Config>) {
|
||||
self.configs.push(config)
|
||||
}
|
||||
|
||||
/// Return number of contained configs.
|
||||
pub fn len(&self) -> usize {
|
||||
self.configs.len()
|
||||
}
|
||||
|
||||
/// Insert `config` at a specific index. The config will take precedence over configs
|
||||
/// with lower indices.
|
||||
pub fn insert(&mut self, idx: usize, config: Arc<dyn Config>) {
|
||||
self.configs.insert(idx, config);
|
||||
}
|
||||
}
|
||||
|
||||
impl Config for UnionConfig {
|
||||
|
Loading…
Reference in New Issue
Block a user