fix: use std::sync::RwLock for cache to support sync methods
Some checks failed
BotServer CI/CD / build (push) Failing after 6m3s
Some checks failed
BotServer CI/CD / build (push) Failing after 6m3s
This commit is contained in:
parent
fd7f48c423
commit
0ac8178baa
1 changed files with 3 additions and 2 deletions
|
|
@ -8,6 +8,7 @@ use std::path::PathBuf;
|
||||||
use std::sync::Arc;
|
use std::sync::Arc;
|
||||||
use std::sync::Arc as StdArc;
|
use std::sync::Arc as StdArc;
|
||||||
use tokio::sync::RwLock;
|
use tokio::sync::RwLock;
|
||||||
|
use std::sync::RwLock as StdRwLock;
|
||||||
use uuid::Uuid;
|
use uuid::Uuid;
|
||||||
use vaultrs::client::{VaultClient, VaultClientSettingsBuilder};
|
use vaultrs::client::{VaultClient, VaultClientSettingsBuilder};
|
||||||
use vaultrs::kv2;
|
use vaultrs::kv2;
|
||||||
|
|
@ -62,7 +63,7 @@ struct CachedSecret {
|
||||||
#[derive(Clone)]
|
#[derive(Clone)]
|
||||||
pub struct SecretsManager {
|
pub struct SecretsManager {
|
||||||
client: Option<StdArc<VaultClient>>,
|
client: Option<StdArc<VaultClient>>,
|
||||||
cache: Arc<RwLock<HashMap<String, CachedSecret>>>,
|
cache: Arc<std::sync::RwLock<HashMap<String, CachedSecret>>>,
|
||||||
cache_ttl: u64,
|
cache_ttl: u64,
|
||||||
enabled: bool,
|
enabled: bool,
|
||||||
}
|
}
|
||||||
|
|
@ -106,7 +107,7 @@ impl SecretsManager {
|
||||||
warn!("Vault not configured. Using environment variables directly.");
|
warn!("Vault not configured. Using environment variables directly.");
|
||||||
return Ok(Self {
|
return Ok(Self {
|
||||||
client: None,
|
client: None,
|
||||||
cache: Arc::new(RwLock::new(HashMap::new())),
|
cache: Arc::new(StdRwLock::new(HashMap::new())),
|
||||||
cache_ttl,
|
cache_ttl,
|
||||||
enabled: false,
|
enabled: false,
|
||||||
});
|
});
|
||||||
|
|
|
||||||
Loading…
Add table
Reference in a new issue