mirror of
https://github.com/meilisearch/meilisearch.git
synced 2024-11-26 12:05:05 +08:00
fmt
This commit is contained in:
parent
8e4928c7ea
commit
79fc3bb84e
@ -19,8 +19,8 @@ pub use option::Opt;
|
||||
|
||||
use actix_web::web;
|
||||
|
||||
use extractors::payload::PayloadConfig;
|
||||
use extractors::authentication::policies::*;
|
||||
use extractors::payload::PayloadConfig;
|
||||
|
||||
pub fn configure_data(config: &mut web::ServiceConfig, data: Data) {
|
||||
let http_payload_size_limit = data.http_payload_size_limit();
|
||||
@ -42,7 +42,7 @@ pub fn configure_data(config: &mut web::ServiceConfig, data: Data) {
|
||||
|
||||
pub fn configure_auth(config: &mut web::ServiceConfig, data: &Data) {
|
||||
let keys = data.api_keys();
|
||||
let auth_config = if let Some(ref master_key) = keys.master {
|
||||
let auth_config = if let Some(ref master_key) = keys.master {
|
||||
let private_key = keys.private.as_ref().unwrap();
|
||||
let public_key = keys.public.as_ref().unwrap();
|
||||
let mut policies = init_policies!(Public, Private, Admin);
|
||||
@ -62,8 +62,8 @@ pub fn configure_auth(config: &mut web::ServiceConfig, data: &Data) {
|
||||
|
||||
#[cfg(feature = "mini-dashboard")]
|
||||
pub fn dashboard(config: &mut web::ServiceConfig, enable_frontend: bool) {
|
||||
use actix_web_static_files::Resource;
|
||||
use actix_web::HttpResponse;
|
||||
use actix_web_static_files::Resource;
|
||||
|
||||
mod generated {
|
||||
include!(concat!(env!("OUT_DIR"), "/generated.rs"));
|
||||
@ -71,22 +71,24 @@ pub fn dashboard(config: &mut web::ServiceConfig, enable_frontend: bool) {
|
||||
|
||||
if enable_frontend {
|
||||
let generated = generated::generate();
|
||||
let mut scope = web::scope("/");
|
||||
// Generate routes for mini-dashboard assets
|
||||
for (path, resource) in generated.into_iter() {
|
||||
let Resource {mime_type, data, ..} = resource;
|
||||
// Redirect index.html to /
|
||||
if path == "index.html" {
|
||||
config.service(web::resource("/").route(web::get().to(move || {
|
||||
HttpResponse::Ok().content_type(mime_type).body(data)
|
||||
})));
|
||||
} else {
|
||||
scope = scope.service(web::resource(path).route(web::get().to(move || {
|
||||
HttpResponse::Ok().content_type(mime_type).body(data)
|
||||
})));
|
||||
}
|
||||
let mut scope = web::scope("/");
|
||||
// Generate routes for mini-dashboard assets
|
||||
for (path, resource) in generated.into_iter() {
|
||||
let Resource {
|
||||
mime_type, data, ..
|
||||
} = resource;
|
||||
// Redirect index.html to /
|
||||
if path == "index.html" {
|
||||
config.service(web::resource("/").route(
|
||||
web::get().to(move || HttpResponse::Ok().content_type(mime_type).body(data)),
|
||||
));
|
||||
} else {
|
||||
scope = scope.service(web::resource(path).route(
|
||||
web::get().to(move || HttpResponse::Ok().content_type(mime_type).body(data)),
|
||||
));
|
||||
}
|
||||
config.service(scope);
|
||||
}
|
||||
config.service(scope);
|
||||
} else {
|
||||
config.route("/", web::get().to(routes::running));
|
||||
}
|
||||
@ -105,7 +107,7 @@ macro_rules! create_app {
|
||||
use actix_web::App;
|
||||
use actix_web::{middleware, web};
|
||||
use meilisearch_http::routes::*;
|
||||
use meilisearch_http::{configure_data, dashboard, configure_auth};
|
||||
use meilisearch_http::{configure_auth, configure_data, dashboard};
|
||||
|
||||
App::new()
|
||||
.configure(|s| configure_data(s, $data.clone()))
|
||||
|
@ -1,8 +1,8 @@
|
||||
use actix_web::{web, HttpResponse};
|
||||
use serde::Serialize;
|
||||
|
||||
use crate::extractors::authentication::{policies::*, GuardedData};
|
||||
use crate::Data;
|
||||
use crate::extractors::authentication::{GuardedData, policies::*};
|
||||
|
||||
pub fn services(cfg: &mut web::ServiceConfig) {
|
||||
cfg.route("/keys", web::get().to(list));
|
||||
|
@ -6,10 +6,10 @@ use serde::Deserialize;
|
||||
use serde_json::Value;
|
||||
|
||||
use crate::error::ResponseError;
|
||||
use crate::extractors::authentication::{policies::*, GuardedData};
|
||||
use crate::index::{default_crop_length, SearchQuery, DEFAULT_SEARCH_LIMIT};
|
||||
use crate::routes::IndexParam;
|
||||
use crate::Data;
|
||||
use crate::extractors::authentication::{GuardedData, policies::*};
|
||||
|
||||
pub fn services(cfg: &mut web::ServiceConfig) {
|
||||
cfg.service(
|
||||
|
@ -1,7 +1,7 @@
|
||||
use log::debug;
|
||||
use actix_web::{web, HttpResponse};
|
||||
|
||||
use crate::extractors::authentication::{GuardedData, policies::*};
|
||||
use crate::extractors::authentication::{policies::*, GuardedData};
|
||||
use crate::index::Settings;
|
||||
use crate::Data;
|
||||
use crate::{error::ResponseError, index::Unchecked};
|
||||
|
@ -3,7 +3,7 @@ use actix_web::{web, HttpResponse};
|
||||
use serde::Serialize;
|
||||
|
||||
use crate::error::ResponseError;
|
||||
use crate::extractors::authentication::{GuardedData, policies::*};
|
||||
use crate::extractors::authentication::{policies::*, GuardedData};
|
||||
use crate::routes::IndexParam;
|
||||
use crate::Data;
|
||||
|
||||
|
@ -1,7 +1,7 @@
|
||||
use std::collections::HashMap;
|
||||
|
||||
use once_cell::sync::Lazy;
|
||||
use serde_json::{Value, json};
|
||||
use serde_json::{json, Value};
|
||||
|
||||
use crate::common::Server;
|
||||
|
||||
@ -11,7 +11,10 @@ static DEFAULT_SETTINGS_VALUES: Lazy<HashMap<&'static str, Value>> = Lazy::new(|
|
||||
map.insert("searchable_attributes", json!(["*"]));
|
||||
map.insert("filterable_attributes", json!([]));
|
||||
map.insert("distinct_attribute", json!(Value::Null));
|
||||
map.insert("ranking_rules", json!(["words", "typo", "proximity", "attribute", "exactness"]));
|
||||
map.insert(
|
||||
"ranking_rules",
|
||||
json!(["words", "typo", "proximity", "attribute", "exactness"]),
|
||||
);
|
||||
map.insert("stop_words", json!([]));
|
||||
map.insert("synonyms", json!({}));
|
||||
map
|
||||
|
Loading…
Reference in New Issue
Block a user