mirror of
https://github.com/meilisearch/MeiliSearch
synced 2025-07-03 20:07:09 +02:00
fix the consistency rules
This commit is contained in:
parent
8089ec668e
commit
9112b26cd1
7 changed files with 57 additions and 39 deletions
|
@ -12,6 +12,7 @@ license.workspace = true
|
|||
|
||||
[dependencies]
|
||||
base64 = "0.13.1"
|
||||
cluster = { path = "../cluster" }
|
||||
enum-iterator = "1.1.3"
|
||||
hmac = "0.12.1"
|
||||
maplit = "1.0.2"
|
||||
|
|
|
@ -6,6 +6,7 @@ use std::collections::{HashMap, HashSet};
|
|||
use std::path::Path;
|
||||
use std::sync::Arc;
|
||||
|
||||
use cluster::Cluster;
|
||||
use error::{AuthControllerError, Result};
|
||||
use maplit::hashset;
|
||||
use meilisearch_types::index_uid_pattern::IndexUidPattern;
|
||||
|
@ -21,17 +22,22 @@ use uuid::Uuid;
|
|||
pub struct AuthController {
|
||||
store: Arc<HeedAuthStore>,
|
||||
master_key: Option<String>,
|
||||
cluster: Option<Cluster>,
|
||||
}
|
||||
|
||||
impl AuthController {
|
||||
pub fn new(db_path: impl AsRef<Path>, master_key: &Option<String>) -> Result<Self> {
|
||||
pub fn new(
|
||||
db_path: impl AsRef<Path>,
|
||||
master_key: &Option<String>,
|
||||
cluster: Option<Cluster>,
|
||||
) -> Result<Self> {
|
||||
let store = HeedAuthStore::new(db_path)?;
|
||||
|
||||
if store.is_empty()? {
|
||||
generate_default_keys(&store)?;
|
||||
}
|
||||
|
||||
Ok(Self { store: Arc::new(store), master_key: master_key.clone() })
|
||||
Ok(Self { store: Arc::new(store), master_key: master_key.clone(), cluster })
|
||||
}
|
||||
|
||||
/// Return the size of the `AuthController` database in bytes.
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue