Skip to content

Commit

Permalink
chore!: bumped poem version
Browse files Browse the repository at this point in the history
  • Loading branch information
juicycleff committed Jan 13, 2024
1 parent ceabe22 commit da5aa62
Show file tree
Hide file tree
Showing 15 changed files with 1,458 additions and 404 deletions.
1,187 changes: 904 additions & 283 deletions Cargo.lock

Large diffs are not rendered by default.

6 changes: 3 additions & 3 deletions Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -24,8 +24,8 @@ derive_more = "0.99"
log4rs = "1"
chrono = "0.4"
tracing-subscriber = { version ="0.3.9", features = ["env-filter"] }
serde = { version = "1.0", features = ["derive"] }
serde_json = "1.0"
serde = { version = "1.0.195", features = ["derive"] }
serde_json = "1.0.111"
serde_derive = "1"
serde_yaml = "0.9"
mockall = "0.12.1"
Expand All @@ -35,7 +35,7 @@ log = "0.4"
tuple = "0.5.1"
syn = { version= "2.0", features=["full","fold", "parsing"] }

poem = { version = "1.3", features = ["sse", "compression", "cookie", "embed", "opentelemetry", "tokio-metrics", "tower-compat", "websocket", "acme", "redis-session", "prometheus", "rustls"] }
poem = { version = "2.0.0", features = ["sse", "compression", "cookie", "embed", "opentelemetry", "tokio-metrics", "tower-compat", "websocket", "acme", "redis-session", "prometheus", "rustls"] }

north-common = { path = "./crates/north-common" }
north-derives = { path = "./crates/north-derives" }
Expand Down
8 changes: 3 additions & 5 deletions crates/north-common/src/discovery/discovery_options.rs
Original file line number Diff line number Diff line change
@@ -1,8 +1,10 @@
use std::collections::HashMap;

#[derive(Copy, Clone, Debug)]
#[derive(Default)]
pub enum DiscoveryHttpMethods {
Post,
#[default]
Get,
Delete,
Patch,
Expand All @@ -11,11 +13,7 @@ pub enum DiscoveryHttpMethods {
Put,
}

impl Default for DiscoveryHttpMethods {
fn default() -> Self {
DiscoveryHttpMethods::Get
}
}

/*
#[derive(Default, Clone)]
pub struct ScriptDiscoveryOptions {
Expand Down
2 changes: 1 addition & 1 deletion crates/north-common/src/registry/service_instance_state.rs
Original file line number Diff line number Diff line change
Expand Up @@ -131,7 +131,7 @@ impl ServiceInstanceState {

pub fn set_connection_failed_time(&mut self, message: Option<String>) {
self.last_connection_failed_timestamp = Some(Local::now().timestamp_millis());
self.last_connection_failed_message = message.unwrap_or_else(|| "".to_string());
self.last_connection_failed_message = message.unwrap_or_default();
self.status = ServiceStatus::Critical;
}

Expand Down
8 changes: 3 additions & 5 deletions crates/north-common/src/registry/service_status_constants.rs
Original file line number Diff line number Diff line change
Expand Up @@ -2,17 +2,15 @@ use std::fmt;

/// States of a service
#[derive(Clone)]
#[derive(Default)]
pub enum ServiceStatus {
#[default]
Critical,
Passing,
Warning,
}

impl Default for ServiceStatus {
fn default() -> Self {
ServiceStatus::Critical
}
}


impl fmt::Display for ServiceStatus {
fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
Expand Down
2 changes: 1 addition & 1 deletion crates/north-common/src/state.rs
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
use syn::parse::ParseStream;


pub trait NorthStateDataClone {
fn clone_box(&self) -> Box<dyn NorthStateData>;
Expand Down
8 changes: 4 additions & 4 deletions crates/north-common/src/utils/serde_utils.rs
Original file line number Diff line number Diff line change
Expand Up @@ -75,7 +75,7 @@ pub fn merge_json(a: &mut Value, b: Value) {
/// merge_json_and_yaml(&mut a, b.to_string())
/// ```
pub fn merge_json_and_yaml(a: &mut Value, raw_str: String) {
let try_json = serde_yaml::from_str::<Value>(&*raw_str).unwrap();
let try_json = serde_yaml::from_str::<Value>(&raw_str).unwrap();
merge_json(a, try_json)
}

Expand Down Expand Up @@ -172,16 +172,16 @@ impl Merge for Value {

fn merge(a: &mut Value, b: &Value) {
match (a, b) {
(&mut Value::Object(ref mut a), &Value::Object(ref b)) => {
(&mut Value::Object(ref mut a), Value::Object(b)) => {
for (k, v) in b {
merge(a.entry(k.clone()).or_insert(Value::Null), v);
}
}
(&mut Value::Array(ref mut a), &Value::Array(ref b)) => {
(&mut Value::Array(ref mut a), Value::Array(b)) => {
a.extend(b.clone());
a.dedup();
}
(&mut Value::Array(ref mut a), &Value::Object(ref b)) => {
(&mut Value::Array(ref mut a), Value::Object(b)) => {
a.push(Value::Object(b.clone()));
a.dedup();
}
Expand Down
4 changes: 2 additions & 2 deletions crates/north-config/src/config_source.rs
Original file line number Diff line number Diff line change
Expand Up @@ -687,8 +687,8 @@ fn process_envs(option: EnvSourceOptions) -> Result<Value, Error> {

let new_key = key.strip_prefix(prefix).expect("env var prefix missing");
let dot_key: String = new_key.replace(separator.clone(), ".").clone().to_case(case);
let new_value: serde_json::Value = serde_json::from_str(value.as_str()).expect("go value");
obj.dot_set(dot_key.as_str(), new_value).unwrap();
let new_value = serde_json::from_str::<serde_json::Value>(value.as_str()).expect("no value");
obj.dot_set(dot_key.as_str(), value).unwrap();
}

Ok(obj)
Expand Down
8 changes: 4 additions & 4 deletions crates/north-config/src/serde_utils.rs
Original file line number Diff line number Diff line change
Expand Up @@ -76,7 +76,7 @@ pub fn merge_json(a: &mut Value, b: Value) {
/// merge_json_and_yaml(&mut a, b.to_string())
/// ```
pub fn merge_json_and_yaml(a: &mut Value, raw_str: String) {
let try_json = serde_yaml::from_str::<Value>(&*raw_str).unwrap();
let try_json = serde_yaml::from_str::<Value>(&raw_str).unwrap();
merge_json(a, try_json)
}

Expand Down Expand Up @@ -173,16 +173,16 @@ impl Merge for Value {

fn merge(a: &mut Value, b: &Value) {
match (a, b) {
(&mut Value::Object(ref mut a), &Value::Object(ref b)) => {
(&mut Value::Object(ref mut a), Value::Object(b)) => {
for (k, v) in b {
merge(a.entry(k.clone()).or_insert(Value::Null), v);
}
}
(&mut Value::Array(ref mut a), &Value::Array(ref b)) => {
(&mut Value::Array(ref mut a), Value::Array(b)) => {
a.extend(b.clone());
a.dedup();
}
(&mut Value::Array(ref mut a), &Value::Object(ref b)) => {
(&mut Value::Array(ref mut a), Value::Object(b)) => {
a.push(Value::Object(b.clone()));
a.dedup();
}
Expand Down
2 changes: 1 addition & 1 deletion crates/north-config/src/watcher.rs
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ pub fn watch_file_path(path: Box<Path>) -> Result<(), crate::Error> {
})
.unwrap();

watcher.watch(&*path, RecursiveMode::Recursive).unwrap();
watcher.watch(&path, RecursiveMode::Recursive).unwrap();

Ok(())
}
2 changes: 1 addition & 1 deletion crates/north-consul/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ error-chain = "0.12"
url = "2.1"

[dev-dependencies]
base64 = "0.13"
base64 = "0.21.7"
hostname = "0.3"
rand = "0.8.3"
rstest = { workspace = true }
Expand Down
2 changes: 1 addition & 1 deletion crates/north-service/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ default = []
async-trait = "0.1"
log = "0.4.14"
nanoid = "0.4"
north-common = "0.0.1"
north-common = "0.1.9"

# Optional deps
async-zeroconf = { version ="0.2", optional = true }
Expand Down
Loading

0 comments on commit da5aa62

Please sign in to comment.