mirror of
https://github.com/meilisearch/meilisearch.git
synced 2024-11-23 02:27:40 +08:00
Merge #213
213: Implement all the CLI options r=MarinPostma a=irevoire closes #206 And I looked into #204, I fixed some default values and tried to test as many options as possible, and I think the cli is already mostly working. If someone knows any issues about it, I would like to hear more 🙂 Co-authored-by: Tamo <tamo@meilisearch.com>
This commit is contained in:
commit
db7215eaa9
@ -85,8 +85,8 @@ pub struct Stats {
|
|||||||
|
|
||||||
impl IndexController {
|
impl IndexController {
|
||||||
pub fn new(path: impl AsRef<Path>, options: &Opt) -> anyhow::Result<Self> {
|
pub fn new(path: impl AsRef<Path>, options: &Opt) -> anyhow::Result<Self> {
|
||||||
let index_size = options.max_mdb_size.get_bytes() as usize;
|
let index_size = options.max_index_size.get_bytes() as usize;
|
||||||
let update_store_size = options.max_udb_size.get_bytes() as usize;
|
let update_store_size = options.max_index_size.get_bytes() as usize;
|
||||||
|
|
||||||
if let Some(ref path) = options.import_snapshot {
|
if let Some(ref path) = options.import_snapshot {
|
||||||
info!("Loading from snapshot {:?}", path);
|
info!("Loading from snapshot {:?}", path);
|
||||||
@ -100,7 +100,7 @@ impl IndexController {
|
|||||||
load_dump(
|
load_dump(
|
||||||
&options.db_path,
|
&options.db_path,
|
||||||
src_path,
|
src_path,
|
||||||
options.max_mdb_size.get_bytes() as usize,
|
options.max_index_size.get_bytes() as usize,
|
||||||
options.max_udb_size.get_bytes() as usize,
|
options.max_udb_size.get_bytes() as usize,
|
||||||
&options.indexer_options,
|
&options.indexer_options,
|
||||||
)?;
|
)?;
|
||||||
@ -119,7 +119,7 @@ impl IndexController {
|
|||||||
&options.dumps_dir,
|
&options.dumps_dir,
|
||||||
uuid_resolver.clone(),
|
uuid_resolver.clone(),
|
||||||
update_handle.clone(),
|
update_handle.clone(),
|
||||||
options.max_mdb_size.get_bytes() as usize,
|
options.max_index_size.get_bytes() as usize,
|
||||||
options.max_udb_size.get_bytes() as usize,
|
options.max_udb_size.get_bytes() as usize,
|
||||||
)?;
|
)?;
|
||||||
|
|
||||||
|
@ -109,15 +109,15 @@ pub struct Opt {
|
|||||||
pub no_analytics: bool,
|
pub no_analytics: bool,
|
||||||
|
|
||||||
/// The maximum size, in bytes, of the main lmdb database directory
|
/// The maximum size, in bytes, of the main lmdb database directory
|
||||||
#[structopt(long, env = "MEILI_MAX_MDB_SIZE", default_value = "100 GiB")]
|
#[structopt(long, env = "MEILI_MAX_INDEX_SIZE", default_value = "100 GiB")]
|
||||||
pub max_mdb_size: Byte,
|
pub max_index_size: Byte,
|
||||||
|
|
||||||
/// The maximum size, in bytes, of the update lmdb database directory
|
/// The maximum size, in bytes, of the update lmdb database directory
|
||||||
#[structopt(long, env = "MEILI_MAX_UDB_SIZE", default_value = "10 GiB")]
|
#[structopt(long, env = "MEILI_MAX_UDB_SIZE", default_value = "100 GiB")]
|
||||||
pub max_udb_size: Byte,
|
pub max_udb_size: Byte,
|
||||||
|
|
||||||
/// The maximum size, in bytes, of accepted JSON payloads
|
/// The maximum size, in bytes, of accepted JSON payloads
|
||||||
#[structopt(long, env = "MEILI_HTTP_PAYLOAD_SIZE_LIMIT", default_value = "10 MiB")]
|
#[structopt(long, env = "MEILI_HTTP_PAYLOAD_SIZE_LIMIT", default_value = "100 MB")]
|
||||||
pub http_payload_size_limit: Byte,
|
pub http_payload_size_limit: Byte,
|
||||||
|
|
||||||
/// Read server certificates from CERTFILE.
|
/// Read server certificates from CERTFILE.
|
||||||
@ -184,11 +184,11 @@ pub struct Opt {
|
|||||||
#[structopt(long, env = "MEILI_DUMPS_DIR", default_value = "dumps/")]
|
#[structopt(long, env = "MEILI_DUMPS_DIR", default_value = "dumps/")]
|
||||||
pub dumps_dir: PathBuf,
|
pub dumps_dir: PathBuf,
|
||||||
|
|
||||||
/// Import a dump from the specified path, must be a `.tar.gz` file.
|
/// Import a dump from the specified path, must be a `.dump` file.
|
||||||
#[structopt(long, conflicts_with = "import-snapshot")]
|
#[structopt(long, conflicts_with = "import-snapshot")]
|
||||||
pub import_dump: Option<PathBuf>,
|
pub import_dump: Option<PathBuf>,
|
||||||
|
|
||||||
#[structopt(flatten)]
|
#[structopt(skip)]
|
||||||
pub indexer_options: IndexerOpts,
|
pub indexer_options: IndexerOpts,
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -73,7 +73,7 @@ pub fn default_settings(dir: impl AsRef<Path>) -> Opt {
|
|||||||
env: "development".to_owned(),
|
env: "development".to_owned(),
|
||||||
#[cfg(all(not(debug_assertions), feature = "analytics"))]
|
#[cfg(all(not(debug_assertions), feature = "analytics"))]
|
||||||
no_analytics: true,
|
no_analytics: true,
|
||||||
max_mdb_size: Byte::from_unit(4.0, ByteUnit::GiB).unwrap(),
|
max_index_size: Byte::from_unit(4.0, ByteUnit::GiB).unwrap(),
|
||||||
max_udb_size: Byte::from_unit(4.0, ByteUnit::GiB).unwrap(),
|
max_udb_size: Byte::from_unit(4.0, ByteUnit::GiB).unwrap(),
|
||||||
http_payload_size_limit: Byte::from_unit(10.0, ByteUnit::MiB).unwrap(),
|
http_payload_size_limit: Byte::from_unit(10.0, ByteUnit::MiB).unwrap(),
|
||||||
ssl_cert_path: None,
|
ssl_cert_path: None,
|
||||||
|
Loading…
Reference in New Issue
Block a user