Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

upgrade: upgrade summer-boot 1.4.2 version #95

Merged
merged 9 commits into from
Dec 27, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions Cargo.toml
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
[workspace]
resolver = "2"
members = [
"summer-boot",
# other members
Expand Down
4 changes: 2 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,7 @@ summer_boot::log
____) | |_| | | | | | | | | | | | __/ | | |_) | (_) | (_) | |_
|_____/ \__,_|_| |_| |_|_| |_| |_|\___|_| |____/ \___/ \___/ \__|

:: Summer Boot Version:: (1.4.0)
:: Summer Boot Version:: (1.4.2)

summer_boot::server::server Server listening on http://0.0.0.0:8080
```
Expand All @@ -58,7 +58,7 @@ summer_boot::server::server Server listening on http://0.0.0.0:8080

Cargo.toml:
```rust
summer-boot = "1.4.0"
summer-boot = "1.4.2"
```

Add resuorce configuration file to src directory
Expand Down
7 changes: 4 additions & 3 deletions example/Cargo.toml
Original file line number Diff line number Diff line change
@@ -1,11 +1,12 @@
[package]
name = "example"
version = "0.1.0"
rust-version = "1.60.0"
rust-version = "1.73.0"
edition = "2021"
description = "summer boot example"
authors = [
"James Zow <[email protected]>"
"James Zow <[email protected]>",
"WanSen AI Team <[email protected]>"
]
license = "Apache-2.0"

Expand All @@ -18,4 +19,4 @@ schemars = "0.8.8"
tokio = { version = "1.19.2", features = ["full"] }

#summer
summer-boot = { version = "1.3", path = "../summer-boot" }
summer-boot = { version = "1.4.2", path = "../summer-boot" }
9 changes: 1 addition & 8 deletions example/src/log.rs
Original file line number Diff line number Diff line change
@@ -1,22 +1,15 @@
use summer_boot::log;

#[cfg(test)]
mod test {

use super::*;

use summer_boot::log;
#[test]
fn log_print() {
// 在使用log的时候需要调用start()方法开启log记录
log::start();

log::info!("Hello Summer Boot");

// debug 模式下日志记录
log::debug!("debug apps");

log::error!("process error");

log::warn!("warning apps");
}

Expand Down
20 changes: 19 additions & 1 deletion example/src/read_yml.rs
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@ pub struct EnvConfig {
加载环境配置
*/
pub fn load_env_conf() -> Option<EnvConfig> {
let path = format!("src/resources/application.yml");
let path = "src/resources/application.yml".to_string();
let schema = yaml_from_str::<RootSchema>(&read_to_string(&path).unwrap_or_else(|_| {
panic!(
"Error loading configuration file {}, please check the configuration!",
Expand Down Expand Up @@ -128,4 +128,22 @@ mod tests {
}
}
}

#[test]
fn test_load_global_config() {
let pro = load_global_config("dev".to_string());
println!("{:?}", pro);
pro.as_ref().map(|a| {
println!("mysqlConfig:{}", serde_json::to_string(&a.mysql).unwrap());
});
}

#[test]
fn test_load_conf() {
let pro = load_conf();
println!("{:?}", pro);
pro.as_ref().map(|a| {
println!("mysqlConfig:{}", serde_json::to_string(&a.mysql).unwrap());
});
}
}
28 changes: 17 additions & 11 deletions summer-boot-actuator/src/configuration_properties.rs
Original file line number Diff line number Diff line change
Expand Up @@ -2,25 +2,31 @@
//! Configuration properties
//!
pub struct ConfigurationProperties {
pub keys_sanitize : Vec<String>,
pub additional_keys_sanitize : Vec<String>,
pub keys_sanitize: Vec<String>,
pub additional_keys_sanitize: Vec<String>,
}

impl ConfigurationProperties {
pub fn new() -> ConfigurationProperties {
ConfigurationProperties {
keys_sanitize: Vec::new(),
additional_keys_sanitize: Vec::new(),
}
}

pub fn getKeysSanitize() -> Vec<String> {
ConfigurationProperties.keys_sanitize
pub fn get_keys_sanitize(&self) -> &Vec<String> {
&self.keys_sanitize
}

pub fn setKeysSanitize(keys_sanitize: Vec<String>) {
ConfigurationProperties.keys_sanitize = keys_sanitize;
pub fn set_keys_sanitize(&mut self, keys_sanitize: Vec<String>) {
self.keys_sanitize = keys_sanitize;
}

pub fn getAdditionalKeysSanitize() -> Vec<String> {
ConfigurationProperties.additional_keys_sanitize
pub fn get_additional_keys_sanitize(&self) -> &Vec<String> {
&self.additional_keys_sanitize
}

pub fn setAdditionalKeysSanitize(additional_keys_sanitize: Vec<String>) {
ConfigurationProperties.additional_keys_sanitize = additional_keys_sanitize;
pub fn set_additional_keys_sanitize(&mut self, additional_keys_sanitize: Vec<String>) {
self.additional_keys_sanitize = additional_keys_sanitize;
}
}
}
2 changes: 1 addition & 1 deletion summer-boot-actuator/src/lib.rs
Original file line number Diff line number Diff line change
@@ -1 +1 @@

mod configuration_properties;
12 changes: 6 additions & 6 deletions summer-boot-autoconfigure/Cargo.toml
Original file line number Diff line number Diff line change
@@ -1,20 +1,20 @@
[package]
name = "summer-boot-autoconfigure"
version = "1.4.0"
rust-version = "1.60.0"
version = "1.4.1"
rust-version = "1.73.0"
edition = "2021"
description = "summer boot autoconfigure"
authors = [
"James Zow <[email protected]>",
"Xinyu Gao <[email protected]>",
"Summeros Team <team@summeros.org>"
"WanSen AI Team <team@wansenai.com>"
]
license = "Apache-2.0"
readme = "README.md"
keywords = ["middleware", "autoconfigure", "summer"]
documentation = "https://github.com/summer-os/summer-boot/summer-boot-autoconfigure/#readme"
repository = "https://github.com/summer-os/summer-boot"
homepage = "https://summeros.io/"
documentation = "https://github.com/wansenai/summer-boot#readme"
repository = "https://github.com/wansenai/summer-boot"
homepage = "https://crates.io/crates/summer-boot"


[dependencies]
Expand Down
16 changes: 8 additions & 8 deletions summer-boot-macro/Cargo.toml
Original file line number Diff line number Diff line change
@@ -1,19 +1,19 @@
[package]
name = "summer-boot-macro"
version = "1.4.0"
rust-version = "1.60.0"
version = "1.4.1"
rust-version = "1.73.0"
edition = "2021"
description = "summer boot macro"
license = "Apache-2.0"
authors = [
"James Zow <[email protected]>",
"Yangandmore <[email protected]>",
"Summeros Team <team@summeros.org>"
"WanSen AI Team <team@wansenai.com>"
]
readme = "README.md"
documentation = "https://github.com/summer-os/summer-boot/blob/master/summer-boot-macro/README.md"
repository = "https://github.com/summer-os/summer-boot"
homepage = "https://summeros.io/"
documentation = "https://github.com/wansenai/summer-boot#readme"
repository = "https://github.com/wansenai/summer-boot"
homepage = "https://crates.io/crates/summer-boot"

[lib]
proc-macro = true
Expand All @@ -25,7 +25,7 @@ syn = { version = "1.0", features = ["full"] }
toml = "0.8"
serde = { version = "1", features = ["derive"] }
serde_json = "1"
summer-boot-autoconfigure = { version = "1.4", path = "../summer-boot-autoconfigure"}
summer-boot-autoconfigure = { version = "1.4.1", path = "../summer-boot-autoconfigure"}

[dev-dependencies]
summer-boot = { version = "1.4", path = "../summer-boot" }
summer-boot = { version = "1.4.1", path = "../summer-boot" }
2 changes: 1 addition & 1 deletion summer-boot-macro/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ Used to write all macros of summer boot
## Getting Started

```rust
summer-boot-macro = "1.4.0"
summer-boot-macro = "1.4.1"
```

## Macro description
Expand Down
17 changes: 8 additions & 9 deletions summer-boot/Cargo.toml
Original file line number Diff line number Diff line change
@@ -1,22 +1,22 @@
[package]
name = "summer-boot"
version = "1.4.0"
rust-version = "1.60.0"
version = "1.4.2"
rust-version = "1.73.0"
edition = "2021"
description = "summer boot"
authors = [
"James Zow <[email protected]>",
"Summeros Team <team@summeros.org>"
"WanSen AI Team <team@wansenai.com>"
]
license = "Apache-2.0"
readme = "README.md"
keywords = ["tcp", "http", "web", "summer"]
documentation = "https://github.com/summer-os/summer-boot#readme"
repository = "https://github.com/summer-os/summer-boot"
homepage = "https://summeros.io/"
documentation = "https://github.com/wansenai/summer-boot#readme"
repository = "https://github.com/wansenai/summer-boot"
homepage = "https://crates.io/crates/summer-boot"

[features]
default = ["macros", "async-h1"]
default = ["macros"]
macros = [
"summer-boot-macro"
]
Expand All @@ -33,7 +33,6 @@ async-std = { version = "1.8.0", features = ["attributes"] }
async-trait = "0.1.41"
async-channel = "1.5.1"
async-dup = "1.2.2"
async-h1 = { version = "2.3.0", optional = true }

#pin
pin-project = "1.0.2"
Expand All @@ -46,7 +45,7 @@ futures-util = "0.3.6"


# summer dependencies
summer-boot-macro = { version = "1.4" , optional = true, path = "../summer-boot-macro"}
summer-boot-macro = { version = "1.4.1" , optional = true, path = "../summer-boot-macro"}

#log
femme = { version = "2.1.1"}
Expand Down
4 changes: 2 additions & 2 deletions summer-boot/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ summer_boot::log
____) | |_| | | | | | | | | | | | __/ | | |_) | (_) | (_) | |_
|_____/ \__,_|_| |_| |_|_| |_| |_|\___|_| |____/ \___/ \___/ \__|

:: Summer Boot Version:: (1.4.0)
:: Summer Boot Version:: (1.4.2)

summer_boot::web2::server::server Server listening on http://0.0.0.0:8080
```
Expand All @@ -25,7 +25,7 @@ summer_boot::web2::server::server Server listening on http://0.0.0.0:8080

Cargo.toml:
```rust
summer-boot = "1.4.0"
summer-boot = "1.4.2"
```

Add resuorce configuration file to src directory
Expand Down
5 changes: 2 additions & 3 deletions summer-boot/src/tcp/unix.rs
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
use super::{is_transient_error, ListenInfo};

use super::Listener;
use crate::Server;
use crate::{http1, Server};

use std::fmt::{self, Display, Formatter};

Expand Down Expand Up @@ -42,8 +42,7 @@ fn handle_unix<State: Clone + Send + Sync + 'static>(app: Server<State>, stream:
task::spawn(async move {
let local_addr = unix_socket_addr_to_string(stream.local_addr());
let peer_addr = unix_socket_addr_to_string(stream.peer_addr());

let fut = async_h1::accept(stream, |mut req| async {
let fut = http1::http::accept(stream, |mut req| async {
req.set_local_addr(local_addr.as_ref());
req.set_peer_addr(peer_addr.as_ref());
app.respond(req).await
Expand Down
Loading