Revert "Revert "Rewrite extension management tools"" (#5273)
Signed-off-by: Angela Ning <aning@squareup.com>
This commit is contained in:
@@ -239,7 +239,11 @@ impl ExtensionManager {
|
||||
pub fn new() -> Self {
|
||||
Self {
|
||||
extensions: Mutex::new(HashMap::new()),
|
||||
context: Mutex::new(PlatformExtensionContext { session_id: None }),
|
||||
context: Mutex::new(PlatformExtensionContext {
|
||||
session_id: None,
|
||||
extension_manager: None,
|
||||
tool_route_manager: None,
|
||||
}),
|
||||
}
|
||||
}
|
||||
|
||||
@@ -452,9 +456,13 @@ impl ExtensionManager {
|
||||
Box::new(client)
|
||||
}
|
||||
ExtensionConfig::Platform { name, .. } => {
|
||||
let def = PLATFORM_EXTENSIONS.get(name.as_str()).ok_or_else(|| {
|
||||
ExtensionError::ConfigError(format!("Unknown platform extension: {}", name))
|
||||
})?;
|
||||
// Normalize the name to match the key used in PLATFORM_EXTENSIONS
|
||||
let normalized_key = normalize(name.clone());
|
||||
let def = PLATFORM_EXTENSIONS
|
||||
.get(normalized_key.as_str())
|
||||
.ok_or_else(|| {
|
||||
ExtensionError::ConfigError(format!("Unknown platform extension: {}", name))
|
||||
})?;
|
||||
let context = self.get_context().await;
|
||||
(def.client_factory)(context)
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user