Repository: meilisearch/meilisearch
File: meilisearch-http/src/option.rs (Rust)

Code before:
    /// This option will trigger an error if `--import-dump` is not defined.
    ///
    /// *This option is not available as an environment variable.*
    #[clap(long, env = MEILI_IGNORE_MISSING_DUMP, requires = "import-dump")]
    #[serde(default)]
    pub ignore_missing_dump: bool,

    /// Prevents a Meilisearch instance with an existing database from throwing an error
    /// when using `--import-dump`. Instead, the dump will be ignored and Meilisearch will
    /// launch using the existing database.
    ///
    /// This option will trigger an error if `--import-dump` is not defined.
    ///
    /// *This option is not available as an environment variable.*
    #[clap(long, env = MEILI_IGNORE_DUMP_IF_DB_EXISTS, requires = "import-dump")]
    #[serde(default)]
    pub ignore_dump_if_db_exists: bool,

    /// Folder where dumps are created when the dump route is called.
    #[clap(long, env = MEILI_DUMPS_DIR, default_value_os_t = default_dumps_dir())]
    #[serde(default = "default_dumps_dir")]
    pub dumps_dir: PathBuf,

    /// Defines how much detail should be present in Meilisearch's logs.

    /// Meilisearch currently supports four log levels, listed in order of increasing verbosity:
    ///
    /// `'ERROR'`: only log unexpected events indicating Meilisearch is not functioning as expected
    /// `'WARN'`: log all unexpected events, regardless of their severity
    /// `'INFO'`: log all events. This is the default value of --log-level
    /// `'DEBUG'`: log all events and include detailed information on Meilisearch's internal processes.
    ///     Useful when diagnosing issues and debugging
    /// `'TRACE'`: log all events and include even more detailed information on Meilisearch's internal processes.
    ///     We do not advise using this level as it is extremely verbose. Use `'DEBUG'` before considering `'TRACE'`.
    #[clap(long, env = MEILI_LOG_LEVEL, default_value_t = default_log_level())]
    #[serde(default = "default_log_level")]
    pub log_level: String,

    /// Enables Prometheus metrics and /metrics route.
    #[cfg(feature = "metrics")]
    #[clap(long, env = MEILI_ENABLE_METRICS_ROUTE)]
    #[serde(default)]
    pub enable_metrics_route: bool,

    #[serde(flatten)]
    #[clap(flatten)]
    pub indexer_options: IndexerOpts,

    #[serde(flatten)]
    #[clap(flatten)]
    pub scheduler_options: SchedulerConfig,

Review comment (suggestion):
```suggestion
    /// Meilisearch currently supports five log levels, listed in order of increasing verbosity:
```

Code after:

impl Opt {
    /// Whether analytics should be enabled or not.
    #[cfg(all(not(debug_assertions), feature = "analytics"))]
    pub fn analytics(&self) -> bool {
        !self.no_analytics
    }

    /// Build a new Opt from config file, env vars and cli args.
    pub fn try_build() -> anyhow::Result<(Self, Option<PathBuf>)> {
        // Parse the args to get the config_file_path.
        let mut opts = Opt::parse();
        let mut config_read_from = None;
        if let Some(config_file_path) = opts
            .config_file_path
            .clone()
            .or_else(|| Some(PathBuf::from("./config.toml")))
        {
            match std::fs::read(&config_file_path) {
                Ok(config) => {
                    // If the file is successfully read, we deserialize it with `toml`.
                    let opt_from_config = toml::from_slice::<Opt>(&config)?;
                    // We inject the values from the toml in the corresponding env vars if needs be. Doing so, we respect the priority toml < env vars < cli args.
                    opt_from_config.export_to_env();
                    // Once injected we parse the cli args once again to take the new env vars into scope.
                    opts = Opt::parse();
                    config_read_from = Some(config_file_path);
                }
                // If we have an error while reading the file defined by the user.
                Err(_) if opts.config_file_path.is_some() => anyhow::bail!(
                    "unable to open or read the {:?} configuration file.",
                    opts.config_file_path.unwrap().display().to_string()
                ),
                _ => (),
            }
        }

        Ok((opts, config_read_from))
    }

    /// Exports the opts values to their corresponding env vars if they are not set.
    fn export_to_env(self) {
        let Opt {
            db_path,
            http_addr,
            master_key,
            env,
            max_index_size,
            max_task_db_size,
            http_payload_size_limit,
            ssl_cert_path,