diff options
| author | Matthieu <matthieu@developershouse.xyz> | 2021-10-13 13:54:00 +0400 |
|---|---|---|
| committer | Matthieu <matthieu@developershouse.xyz> | 2021-10-13 13:54:00 +0400 |
| commit | f96d8caf1622b8494bcbc5318ac7db6e582035f5 (patch) | |
| tree | cfa1c10b8862061cd01fe3a291feda698ebf0c73 /common/rust/src | |
| parent | a85898459a1c685d389d65092d93cc729a14bb24 (diff) | |
circleci for macos, windows and arm/x86 macos
Diffstat (limited to 'common/rust/src')
| -rw-r--r-- | common/rust/src/config.rs | 1 | ||||
| -rw-r--r-- | common/rust/src/lib.rs | 4 | ||||
| -rw-r--r-- | common/rust/src/redis.rs | 15 |
3 files changed, 19 insertions, 1 deletions
diff --git a/common/rust/src/config.rs b/common/rust/src/config.rs index c4ad7b0..e4dbade 100644 --- a/common/rust/src/config.rs +++ b/common/rust/src/config.rs @@ -14,6 +14,7 @@ pub struct Settings<T> { pub config: T, pub monitoring: crate::monitoring::MonitoringConfiguration, pub nats: crate::nats::NatsConfiguration, + pub redis: crate::redis::RedisConfiguration, } /// diff --git a/common/rust/src/lib.rs b/common/rust/src/lib.rs index be3c913..f4e27fc 100644 --- a/common/rust/src/lib.rs +++ b/common/rust/src/lib.rs @@ -5,10 +5,12 @@ pub mod monitoring; pub mod nats; pub mod payloads; pub mod error; +pub mod redis; pub use log as log; pub use serde as serde; pub use ::config as config_crate; pub use prometheus as prometheus; pub use ::nats as nats_crate; -pub use testcontainers as testcontainers;
\ No newline at end of file +pub use testcontainers as testcontainers; +pub use ::redis as redis_crate;
\ No newline at end of file diff --git a/common/rust/src/redis.rs b/common/rust/src/redis.rs new file mode 100644 index 0000000..a196f8d --- /dev/null +++ b/common/rust/src/redis.rs @@ -0,0 +1,15 @@ +use redis::Client; +use serde::Deserialize; + + +#[derive(Clone, Debug, Deserialize)] +pub struct RedisConfiguration { + pub url: String, +} + +// Allows the configuration to directly create a nats connection +impl Into<Client> for RedisConfiguration { + fn into(self) -> Client { + redis::Client::open(self.url).unwrap() + } +} |
