2019-10-31 22:00:36 +08:00
|
|
|
use structopt::StructOpt;
|
|
|
|
|
2020-02-06 22:42:35 +08:00
|
|
|
const POSSIBLE_ENV: [&str; 2] = ["development", "production"];
|
|
|
|
|
2019-11-20 00:09:06 +08:00
|
|
|
#[derive(Debug, Clone, StructOpt)]
|
|
|
|
pub struct Opt {
|
2019-10-31 22:00:36 +08:00
|
|
|
/// The destination where the database must be created.
|
2019-11-29 22:22:45 +08:00
|
|
|
#[structopt(long, env = "MEILI_DB_PATH", default_value = "./data.ms")]
|
2019-11-20 00:09:06 +08:00
|
|
|
pub db_path: String,
|
2019-10-31 22:00:36 +08:00
|
|
|
|
2019-11-20 00:09:06 +08:00
|
|
|
/// The address on which the http server will listen.
|
2019-11-29 22:23:26 +08:00
|
|
|
#[structopt(long, env = "MEILI_HTTP_ADDR", default_value = "127.0.0.1:7700")]
|
2019-10-31 22:00:36 +08:00
|
|
|
pub http_addr: String,
|
|
|
|
|
2019-11-20 00:09:06 +08:00
|
|
|
/// The master key allowing you to do everything on the server.
|
2020-02-06 22:41:11 +08:00
|
|
|
#[structopt(long, env = "MEILI_MASTER_KEY")]
|
|
|
|
pub master_key: Option<String>,
|
2019-11-22 02:15:33 +08:00
|
|
|
|
2020-02-06 22:42:35 +08:00
|
|
|
/// This environment variable must be set to `production` if your are running in production.
|
2020-03-02 23:56:11 +08:00
|
|
|
/// If the server is running in development mode more logs will be displayed,
|
|
|
|
/// and the master key can be avoided which implies that there is no security on the updates routes.
|
|
|
|
/// This is useful to debug when integrating the engine with another service.
|
2020-02-06 22:42:35 +08:00
|
|
|
#[structopt(long, env = "MEILI_ENV", default_value = "development", possible_values = &POSSIBLE_ENV)]
|
|
|
|
pub env: String,
|
|
|
|
|
2019-11-22 02:15:33 +08:00
|
|
|
/// Do not send analytics to Meili.
|
|
|
|
#[structopt(long, env = "MEILI_NO_ANALYTICS")]
|
|
|
|
pub no_analytics: bool,
|
2020-04-29 06:40:06 +08:00
|
|
|
|
|
|
|
/// The maximum size, in bytes, of the main lmdb database directory
|
2020-04-30 03:26:58 +08:00
|
|
|
#[structopt(long, env = "MEILI_MAIN_MAP_SIZE", default_value = "107374182400")] // 100GB
|
2020-04-29 06:40:06 +08:00
|
|
|
pub main_map_size: usize,
|
|
|
|
|
|
|
|
/// The maximum size, in bytes, of the update lmdb database directory
|
2020-04-30 03:26:58 +08:00
|
|
|
#[structopt(long, env = "MEILI_UPDATE_MAP_SIZE", default_value = "107374182400")] // 100GB
|
2020-04-29 06:40:06 +08:00
|
|
|
pub update_map_size: usize
|
2020-04-30 03:26:58 +08:00
|
|
|
}
|