From 833063848d05e69dd71f396039683fa5dc50bead Mon Sep 17 00:00:00 2001 From: RWDai <27391645+RWDai@users.noreply.github.com> Date: Tue, 9 Apr 2024 14:54:19 +0800 Subject: [PATCH] chore:update spacegate version(#703) --- Cargo.toml | 2 +- backend/gateways/spacegate-plugins/Cargo.toml | 2 +- .../gateways/spacegate-plugins/src/plugin/auth.rs | 2 +- .../src/plugin/op_redis_publisher.rs | 13 +++---------- 4 files changed, 6 insertions(+), 13 deletions(-) diff --git a/Cargo.toml b/Cargo.toml index 38a90daf3..f3d59cdc6 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -80,7 +80,7 @@ tardis = { version = "0.1.0-rc.11" } spacegate-shell = { git = "https://github.com/ideal-world/spacegate.git", branch = "master", features = [ "cache", "k8s", -# "ext-redis", + # "ext-redis", ] } spacegate-plugin = { git = "https://github.com/ideal-world/spacegate.git", branch = "master" } diff --git a/backend/gateways/spacegate-plugins/Cargo.toml b/backend/gateways/spacegate-plugins/Cargo.toml index 9d216dc4d..389684348 100644 --- a/backend/gateways/spacegate-plugins/Cargo.toml +++ b/backend/gateways/spacegate-plugins/Cargo.toml @@ -16,7 +16,7 @@ schema = ["spacegate-plugin/schema"] [dependencies] serde.workspace = true lazy_static.workspace = true -spacegate-shell.workspace = true +spacegate-shell = { workspace = true, features = ["cache", "k8s", "ext-redis"] } spacegate-plugin = { workspace = true, features = ["schema"], optional = true } bios-sdk-invoke = { path = "../../../frontend/sdks/invoke", features = [ diff --git a/backend/gateways/spacegate-plugins/src/plugin/auth.rs b/backend/gateways/spacegate-plugins/src/plugin/auth.rs index 78d6c6421..84d5b6cab 100644 --- a/backend/gateways/spacegate-plugins/src/plugin/auth.rs +++ b/backend/gateways/spacegate-plugins/src/plugin/auth.rs @@ -12,7 +12,7 @@ use serde::{Deserialize, Serialize}; use spacegate_shell::{ hyper::{ self, header, - http::{self, HeaderMap, HeaderName, HeaderValue, StatusCode}, + http::{HeaderMap, HeaderName, HeaderValue, StatusCode}, Method, Request, Response, }, kernel::{extension::Reflect, helper_layers::function::Inner}, diff --git a/backend/gateways/spacegate-plugins/src/plugin/op_redis_publisher.rs b/backend/gateways/spacegate-plugins/src/plugin/op_redis_publisher.rs index 48691bd25..9e8ebae01 100644 --- a/backend/gateways/spacegate-plugins/src/plugin/op_redis_publisher.rs +++ b/backend/gateways/spacegate-plugins/src/plugin/op_redis_publisher.rs @@ -4,13 +4,9 @@ use http::Response; use jsonpath_rust::JsonPathInst; use serde::{Deserialize, Serialize}; use spacegate_shell::{ - kernel::{ - extension::{EnterTime, GatewayName}, - SgRequest, SgResponse, - }, + kernel::{extension::EnterTime, SgRequest, SgResponse}, plugin::{Inner, Plugin, PluginConfig}, - spacegate_ext_redis::global_repo, - BoxError, + BoxError, SgRequestExt as _, }; use tardis::{ cache::Script, @@ -70,10 +66,7 @@ impl Plugin for RedisPublisherPlugin { } async fn call(&self, req: SgRequest, inner: Inner) -> Result, spacegate_shell::BoxError> { - let Some(gateway_name) = req.extensions().get::() else { - return Err("missing gateways name".into()); - }; - let Some(client) = global_repo().get(gateway_name) else { + let Some(client) = req.get_redis_client_by_gateway_name() else { return Err("missing redis client".into()); }; let spec_id = RedisPublisherPlugin::parse_spec_id(&req);