Skip to content
This repository has been archived by the owner on Apr 26, 2024. It is now read-only.

Commit

Permalink
Merge pull request #19 from ralvescosta/develop
Browse files Browse the repository at this point in the history
Develop
  • Loading branch information
ralvescosta authored Feb 21, 2023
2 parents c9e8c02 + 7bd61d9 commit bb4d746
Show file tree
Hide file tree
Showing 68 changed files with 368 additions and 190 deletions.
306 changes: 259 additions & 47 deletions Cargo.lock

Large diffs are not rendered by default.

1 change: 0 additions & 1 deletion Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,6 @@
members = [
"amqp",
"env",
"errors",
"health_readiness",
"httpw",
"logging",
Expand Down
2 changes: 1 addition & 1 deletion amqp/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,6 @@ edition = "2021"
mocks = ["dep:mockall"]

[dependencies]
errors = { path = "../errors" }
env = { path = "../env" }
traces = { path = "../traces" }

Expand All @@ -20,6 +19,7 @@ serde_json = { version = "1.0.91" }
serde = { version = "1.0.152", features = ["derive"] }
tokio = { version = "1.25.0", features = ["default"] }
futures-util = { version = "0.3.26"}
thiserror = { version = "1.0.38" }

# Used only with feature mock
mockall = { version = "0.11.3", optional = true }
Expand Down
4 changes: 1 addition & 3 deletions amqp/src/client.rs
Original file line number Diff line number Diff line change
@@ -1,13 +1,11 @@
use crate::types::PublishParams;

use super::{
defs,
topology::ExchangeKind as MyExchangeKind,
types::{AmqpPayload, AmqpTracePropagator},
};
use crate::{errors::AmqpError, types::PublishParams};
use async_trait::async_trait;
use env::{Configs, DynamicConfig};
use errors::amqp::AmqpError;
use lapin::{
message::BasicGetMessage,
options::{
Expand Down
2 changes: 1 addition & 1 deletion amqp/src/consumer.rs
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
use crate::{
client::Amqp,
errors::AmqpError,
topology::{ConsumerHandler, QueueDefinition},
types::{new_span, Metadata},
};
use errors::amqp::AmqpError;
use lapin::{
message::Delivery,
options::{BasicAckOptions, BasicNackOptions, BasicPublishOptions},
Expand Down
2 changes: 1 addition & 1 deletion amqp/src/dispatcher.rs
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
use crate::{
client::Amqp,
consumer::consume,
errors::AmqpError,
topology::{ConsumerHandler, QueueDefinition},
};
use errors::amqp::AmqpError;
use futures_util::{future::join_all, StreamExt};
use opentelemetry::global;
use std::sync::Arc;
Expand Down
File renamed without changes.
1 change: 1 addition & 0 deletions amqp/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@ mod consumer;
pub mod client;
pub mod defs;
pub mod dispatcher;
pub mod errors;
#[cfg(test)]
pub mod mocks;
#[cfg(feature = "mocks")]
Expand Down
3 changes: 1 addition & 2 deletions amqp/src/mocks.rs
Original file line number Diff line number Diff line change
Expand Up @@ -2,9 +2,8 @@ use super::{
topology::ExchangeKind as MyExchangeKind,
types::{AmqpPayload, PublishParams},
};
use crate::client::Amqp;
use crate::{client::Amqp, errors::AmqpError};
use async_trait::async_trait;
use errors::amqp::AmqpError;
use lapin::{
message::BasicGetMessage,
types::{AMQPValue, FieldTable, ShortString},
Expand Down
6 changes: 2 additions & 4 deletions amqp/src/topology.rs
Original file line number Diff line number Diff line change
@@ -1,10 +1,8 @@
use std::{collections::BTreeMap, sync::Arc};

use crate::{client::Amqp, defs};
use crate::{client::Amqp, defs, errors::AmqpError};
use async_trait::async_trait;
use errors::amqp::AmqpError;
use lapin::types::{AMQPValue, FieldTable, LongInt, LongString, ShortString};
use opentelemetry::Context;
use std::{collections::BTreeMap, sync::Arc};
use tracing::debug;

#[derive(Debug, Clone, Default)]
Expand Down
2 changes: 1 addition & 1 deletion amqp/src/types.rs
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
use super::defs;
use errors::amqp::AmqpError;
use crate::errors::AmqpError;
use lapin::{
protocol::basic::AMQPProperties,
types::{AMQPValue, FieldTable, LongInt, ShortString},
Expand Down
3 changes: 0 additions & 3 deletions auth/src/defs.rs
Original file line number Diff line number Diff line change
@@ -1,11 +1,8 @@
pub enum UsersScopes {}

pub enum ThingsScopes {}

pub enum PlatformScopes {}

pub enum Scopes {
USER(UsersScopes),
THING(ThingsScopes),
PLATFORM(PlatformScopes),
}
2 changes: 1 addition & 1 deletion auth/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -2,4 +2,4 @@ mod defs;
pub mod jwt_manager;
mod types;

pub use defs::{PlatformScopes, Scopes, ThingsScopes, UsersScopes};
pub use defs::{PlatformScopes, Scopes, UsersScopes};
2 changes: 1 addition & 1 deletion env/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -4,9 +4,9 @@ version = "0.1.0"
edition = "2021"

[dependencies]
errors = { path = "../errors" }
secrets-manager = { path = "../secrets_manager" }

dotenvy = { version = "0.15.6" }
base64 = { version = "0.13.1" }
tracing = { version = "0.1.37" }
thiserror = { version = "1.0.38" }
2 changes: 1 addition & 1 deletion env/src/configs_builder.rs
Original file line number Diff line number Diff line change
Expand Up @@ -13,10 +13,10 @@ use crate::{
POSTGRES_PORT_ENV_KEY, POSTGRES_USER_ENV_KEY, SECRET_KEY_ENV_KEY, SECRET_PREFIX,
SECRET_PREFIX_TO_DECODE, SQLITE_FILE_NAME_ENV_KEY,
},
errors::ConfigsError,
Environment,
};
use dotenvy::from_filename;
use errors::configs::ConfigsError;
use secrets_manager::{AwsSecretClientBuilder, DummyClient, SecretClient};
use std::{env, sync::Arc};
use tracing::error;
Expand Down
2 changes: 1 addition & 1 deletion errors/src/configs.rs → env/src/errors.rs
Original file line number Diff line number Diff line change
Expand Up @@ -6,5 +6,5 @@ pub enum ConfigsError {
InternalError,

#[error("error to load secrets from secret manager - `{0}`")]
SecretLoadingError(String)
SecretLoadingError(String),
}
3 changes: 2 additions & 1 deletion env/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -2,10 +2,11 @@ mod configs;
mod configs_builder;
pub mod def;
mod environment;
pub mod errors;

pub use configs::{
AppConfig, AwsConfig, Configs, DynamicConfig, DynamoConfig, Empty, HealthReadinessConfig,
MQTTConfig, OTLPConfig, PostgresConfig, SqliteConfig,
};
pub use configs_builder::ConfigBuilder;
pub use environment::Environment;
pub use environment::Environment;
7 changes: 0 additions & 7 deletions errors/Cargo.toml

This file was deleted.

1 change: 0 additions & 1 deletion errors/README.md

This file was deleted.

7 changes: 0 additions & 7 deletions errors/src/http_server.rs

This file was deleted.

12 changes: 0 additions & 12 deletions errors/src/lib.rs

This file was deleted.

13 changes: 0 additions & 13 deletions errors/src/otel.rs

This file was deleted.

10 changes: 0 additions & 10 deletions errors/src/protocol.rs

This file was deleted.

7 changes: 0 additions & 7 deletions errors/src/repositories.rs

This file was deleted.

2 changes: 1 addition & 1 deletion health_readiness/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,6 @@ version = "0.1.0"
edition = "2021"

[dependencies]
errors = { path = "../errors" }
httpw = { path = "../httpw" }
env = { path = "../env" }

Expand All @@ -14,4 +13,5 @@ deadpool-postgres = { version = "0.10.5" }
lapin = { version = "2.1.1" }
paho-mqtt = { version = "0.12.0" }
actix-web = { version = "4.3.0" }
thiserror = { version = "1.0.38" }

File renamed without changes.
1 change: 1 addition & 0 deletions health_readiness/src/lib.rs
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
mod controller;
mod dynamodb;
pub mod errors;
mod mqtt;
mod postgres;
mod rabbitmq;
Expand Down
3 changes: 1 addition & 2 deletions health_readiness/src/mqtt/check.rs
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
use crate::HealthChecker;
use errors::health_readiness::HealthReadinessError;
use crate::{errors::HealthReadinessError, HealthChecker};
use paho_mqtt::AsyncClient;
use std::sync::Arc;
use tracing::debug;
Expand Down
3 changes: 1 addition & 2 deletions health_readiness/src/postgres/check.rs
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
use crate::HealthChecker;
use crate::{errors::HealthReadinessError, HealthChecker};
use deadpool_postgres::Pool;
use errors::health_readiness::HealthReadinessError;
use std::sync::Arc;
use tracing::error;

Expand Down
3 changes: 1 addition & 2 deletions health_readiness/src/rabbitmq/check.rs
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
use crate::HealthChecker;
use errors::health_readiness::HealthReadinessError;
use crate::{errors::HealthReadinessError, HealthChecker};
use lapin::Connection;
use std::sync::Arc;

Expand Down
11 changes: 5 additions & 6 deletions health_readiness/src/server.rs
Original file line number Diff line number Diff line change
@@ -1,12 +1,11 @@
use crate::controller;
use crate::postgres::PostgresHealthChecker;
use crate::rabbitmq::RabbitMqHealthChecker;
use crate::HealthReadinessImpl;
use crate::{mqtt::MqttHealthChecker, HealthChecker};
use crate::{
controller, errors::HealthReadinessError, mqtt::MqttHealthChecker,
postgres::PostgresHealthChecker, rabbitmq::RabbitMqHealthChecker, HealthChecker,
HealthReadinessImpl,
};
use actix_web::{middleware as actix_middleware, web, App, HttpServer};
use deadpool_postgres::Pool;
use env::HealthReadinessConfig;
use errors::health_readiness::HealthReadinessError;
use httpw::middlewares;
use lapin::Connection;
use paho_mqtt::AsyncClient;
Expand Down
2 changes: 1 addition & 1 deletion health_readiness/src/service.rs
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
use errors::health_readiness::HealthReadinessError;
use crate::errors::HealthReadinessError;
use std::sync::Arc;
use tracing::error;

Expand Down
5 changes: 4 additions & 1 deletion httpw/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -13,4 +13,7 @@ actix-cors = { version = "0.6.3" }
serde = { version = "1.0.152", features = ["derive"] }
serde_json = { version = "1.0.93" }
tracing = { version = "0.1.37" }
opentelemetry = { version = "0.18.0" }
opentelemetry = { version = "0.18.0" }
actix-web-opentelemetry = { version = "0.13.0", features = ["metrics"] }
utoipa = { version = "3.0.2", features = ["actix_extras"] }
utoipa-swagger-ui = { version = "3.0.2", features = ["actix-web"] }
Loading

0 comments on commit bb4d746

Please sign in to comment.