Skip to content

Commit

Permalink
Merge branch 'main' of https://github.com/ideal-world/bios
Browse files Browse the repository at this point in the history
  • Loading branch information
ljl committed Apr 8, 2024
2 parents 53ce7f4 + a8e8b14 commit 0e67ea8
Show file tree
Hide file tree
Showing 36 changed files with 56 additions and 38 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/space-gateway-docker-push.yml
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ name: Publish rust gateways docker image
on:
push:
paths:
- "backend/gateways/spacegate-lib/**"
- "backend/gateways/spacegate-plugins/**"
- "backend/supports/auth/**"
- "backend/services/spacegate/**"
- "Cargo.toml"
Expand Down
58 changes: 29 additions & 29 deletions Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -3,35 +3,35 @@
#resolver = "2"

members = [
"backend/basic",
# "backend/spi/*",
"backend/spi/spi-cache",
"backend/spi/spi-search",
"backend/spi/spi-graph",
"backend/spi/spi-kv",
"backend/spi/spi-log",
"backend/spi/spi-object",
"backend/spi/spi-plugin",
"backend/spi/spi-stats",
"backend/spi/spi-reldb",
"backend/gateways/test",
"backend/gateways/spacegate-lib",
"backend/middlewares/*",
"backend/supports/iam",
"backend/supports/auth",
"frontend/enhance-wasm",
"backend/supports/reach",
"backend/services/*",
"frontend/sdks/*",
"frontend/clients/*",
"backend/basic",
# "backend/spi/*",
"backend/spi/spi-cache",
"backend/spi/spi-search",
"backend/spi/spi-graph",
"backend/spi/spi-kv",
"backend/spi/spi-log",
"backend/spi/spi-object",
"backend/spi/spi-plugin",
"backend/spi/spi-stats",
"backend/spi/spi-reldb",
"backend/gateways/test",
"backend/gateways/spacegate-plugins",
"backend/middlewares/*",
"backend/supports/iam",
"backend/supports/auth",
"frontend/enhance-wasm",
"backend/supports/reach",
"backend/services/*",
"frontend/sdks/*",
"frontend/clients/*",
]

[workspace.package]
version = "0.1.0"
authors = [
"gudaoxuri <i@sunisle.org>",
"hermitCode <17743125563@163.com>",
"RWDai <rwdai@foxmail.com>",
"gudaoxuri <i@sunisle.org>",
"hermitCode <17743125563@163.com>",
"RWDai <rwdai@foxmail.com>",
]
homepage = "https://bios.idealworld.group"
documentation = "https://bios.idealworld.group"
Expand Down Expand Up @@ -77,11 +77,11 @@ tardis = { git = "https://github.com/ideal-world/tardis.git", rev = "191f3ec" }
# "ext-redis",
# "ext-axum",
# ] }
spacegate-shell = { git = "https://github.com/ideal-world/spacegate.git", branch = "dev", features = [
"cache",
"k8s",
"ext-redis",
"ext-axum",
spacegate-shell = { git = "https://github.com/ideal-world/spacegate.git", branch = "master", features = [
"cache",
"k8s",
"ext-redis",
"ext-axum",
] }

spacegate-plugin = { git = "https://github.com/ideal-world/spacegate.git", branch = "master" }
7 changes: 6 additions & 1 deletion backend/basic/src/helper/bios_ctx_helper.rs
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@ where
}
}

// xxx_check_own function will check the owner is empty or not.
// check_own_xxx function will check the owner is empty or not.
pub fn check_own_fill_ctx(request: &Request, funs: &TardisFunsInst, ctx: &mut TardisContext) -> TardisResult<()> {
unsafe_check_ctx(
request,
Expand All @@ -60,6 +60,7 @@ pub fn check_own_fill_ctx(request: &Request, funs: &TardisFunsInst, ctx: &mut Ta
)
}

// 业务不安全方法,请在接口确定将会使用 `head_key_bios_ctx`(default:'Bios-Ctx')的上下文填充当前上下文
pub fn unsafe_fill_ctx(request: &Request, funs: &TardisFunsInst, ctx: &mut TardisContext) -> TardisResult<()> {
unsafe_check_ctx(
request,
Expand All @@ -82,6 +83,7 @@ pub fn unsafe_fill_ctx(request: &Request, funs: &TardisFunsInst, ctx: &mut Tardi
)
}

// also see [unsafe_fill_ctx] , only fill the owner.
pub fn unsafe_fill_owner_only(request: &Request, funs: &TardisFunsInst, ctx: &mut TardisContext) -> TardisResult<()> {
unsafe_check_ctx(
request,
Expand All @@ -94,6 +96,7 @@ pub fn unsafe_fill_owner_only(request: &Request, funs: &TardisFunsInst, ctx: &mu
)
}

// also see [unsafe_fill_ctx] , only fill the own_paths.
pub fn unsafe_fill_own_paths_only(request: &Request, funs: &TardisFunsInst, ctx: &mut TardisContext) -> TardisResult<()> {
unsafe_check_ctx(
request,
Expand All @@ -106,6 +109,7 @@ pub fn unsafe_fill_own_paths_only(request: &Request, funs: &TardisFunsInst, ctx:
)
}

// also see [unsafe_fill_ctx] , only fill the roles.
pub fn unsafe_fill_roles_only(request: &Request, funs: &TardisFunsInst, ctx: &mut TardisContext) -> TardisResult<()> {
unsafe_check_ctx(
request,
Expand All @@ -125,6 +129,7 @@ pub fn unsafe_fill_roles_only(request: &Request, funs: &TardisFunsInst, ctx: &mu
)
}

// also see [unsafe_fill_ctx] , only fill the groups.
pub fn unsafe_fill_groups_only(request: &Request, funs: &TardisFunsInst, ctx: &mut TardisContext) -> TardisResult<()> {
unsafe_check_ctx(
request,
Expand Down
1 change: 1 addition & 0 deletions backend/basic/src/helper/request_helper.rs
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@ use tardis::{

pub const REMOTE_ADDR: &str = "remote-addr";

// Add ip to context
pub async fn add_ip(ip: Option<String>, ctx: &TardisContext) -> TardisResult<()> {
if let Some(ip) = ip {
ctx.add_ext(REMOTE_ADDR, &ip).await?;
Expand Down
1 change: 1 addition & 0 deletions backend/basic/src/process/ci_processor.rs
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@ impl Default for AppKeyConfig {
}
}

// signature ak
pub fn signature(app_key_config: &AppKeyConfig, method: &str, path: &str, query: &str, mut header: Vec<(String, String)>) -> TardisResult<Vec<(String, String)>> {
let sorted_req_query = sort_query(query);
let date = Utc::now().format("%a, %d %b %Y %T GMT").to_string();
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
[package]
name = "spacegate-lib"
name = "spacegate-plugins"
version.workspace = true
authors.workspace = true
homepage.workspace = true
Expand All @@ -19,7 +19,9 @@ lazy_static.workspace = true
spacegate-shell.workspace = true
spacegate-plugin = { workspace = true, features = ["schema"], optional = true }

bios-sdk-invoke = { path = "../../../frontend/sdks/invoke", features = ["spi_log"] }
bios-sdk-invoke = { path = "../../../frontend/sdks/invoke", features = [
"spi_log",
] }


jsonpath-rust = "0.3.1"
Expand Down
File renamed without changes.
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ use testcontainers_modules::redis::Redis;

#[tokio::test]
async fn test() {
env::set_var("RUST_LOG", "info,spacegate-lib=trace,bios_auth=trace,tardis=trace");
env::set_var("RUST_LOG", "info,spacegate-plugins=trace,bios_auth=trace,tardis=trace");
tracing_subscriber::fmt::init();

let docker = testcontainers::clients::Cli::default();
Expand Down
10 changes: 8 additions & 2 deletions backend/services/spacegate/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -15,9 +15,15 @@ publish.workspace = true
[dependencies]
serde.workspace = true
lazy_static.workspace = true
spacegate-shell = { workspace = true, features = ["k8s", "plugin-all", "ext-redis", "ext-axum", "cache"] }
spacegate-shell = { workspace = true, features = [
"k8s",
"plugin-all",
"ext-redis",
"ext-axum",
"cache",
] }
tardis = { workerspace = true }
spacegate-lib = { path = "../../gateways/spacegate-lib" }
spacegate-plugins = { path = "../../gateways/spacegate-plugins" }
envy = "0.4"
[dev-dependencies]
pprof = { version = "0.13", features = ["flamegraph"] }
Expand Down
2 changes: 1 addition & 1 deletion backend/services/spacegate/build.sh
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@ fi

# cargo update;
cargo build $RUST_BUILD_ARG;
mv ../../target/$TARGET_DIR/bios-spacegate ./
mv ../../../target/$TARGET_DIR/bios-spacegate ./


### Docker
Expand Down
2 changes: 1 addition & 1 deletion backend/services/spacegate/src/main.rs
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
use serde::Deserialize;
use spacegate_lib::register_lib_plugins;
use spacegate_plugins::register_lib_plugins;
use spacegate_shell::plugin::SgPluginRepository;
use spacegate_shell::BoxError;
use tardis::basic::tracing::TardisTracing;
Expand Down
3 changes: 3 additions & 0 deletions backend/supports/iam/src/basic/serv/iam_open_serv.rs
Original file line number Diff line number Diff line change
Expand Up @@ -78,6 +78,7 @@ impl IamOpenServ {
icon: spec_req.icon.clone(),
scope_level: spec_req.scope_level.clone(),
disabled: spec_req.disabled,
ext: spec_req.url.clone(),
..Default::default()
},
funs,
Expand All @@ -92,6 +93,7 @@ impl IamOpenServ {
kind: IamResKind::Spec,
scope_level: spec_req.scope_level.clone(),
disabled: spec_req.disabled,
ext: spec_req.url.clone(),
..Default::default()
},
funs,
Expand Down Expand Up @@ -142,6 +144,7 @@ impl IamOpenServ {
kind: IamResKind::Spec,
scope_level: spec.scope_level.clone(),
disabled: spec.disabled,
ext: spec.url.clone(),
..Default::default()
},
funs,
Expand Down

0 comments on commit 0e67ea8

Please sign in to comment.