From 3878c289dfe8a301374ab5c83eabe66205cbf6cf Mon Sep 17 00:00:00 2001 From: Guillaume Mourier Date: Thu, 1 Sep 2022 22:34:20 +0200 Subject: [PATCH 1/2] feat: add missing env var for dumps and snapshots feature --- meilisearch-http/src/option.rs | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/meilisearch-http/src/option.rs b/meilisearch-http/src/option.rs index 6848e693d..3ca967b0e 100644 --- a/meilisearch-http/src/option.rs +++ b/meilisearch-http/src/option.rs @@ -103,15 +103,15 @@ pub struct Opt { /// Defines the path of the snapshot file to import. /// This option will, by default, stop the process if a database already exist or if no snapshot exists at /// the given path. If this option is not specified no snapshot is imported. - #[clap(long)] + #[clap(long, env = "MEILI_IMPORT_SNAPSHOT")] pub import_snapshot: Option, /// The engine will ignore a missing snapshot and not return an error in such case. - #[clap(long, requires = "import-snapshot")] + #[clap(long, env = "MEILI_IGNORE_MISSING_SNAPSHOT", requires = "import-snapshot")] pub ignore_missing_snapshot: bool, /// The engine will skip snapshot importation and not return an error in such case. - #[clap(long, requires = "import-snapshot")] + #[clap(long, env = "MEILI_IGNORE_SNAPSHOT_IF_DB_EXISTS", requires = "import-snapshot")] pub ignore_snapshot_if_db_exists: bool, /// Defines the directory path where meilisearch will create snapshot each snapshot_time_gap. @@ -127,15 +127,15 @@ pub struct Opt { pub snapshot_interval_sec: u64, /// Import a dump from the specified path, must be a `.dump` file. - #[clap(long, conflicts_with = "import-snapshot")] + #[clap(long, env = "MEILI_IMPORT_DUMP", conflicts_with = "import-snapshot")] pub import_dump: Option, /// If the dump doesn't exists, load or create the database specified by `db-path` instead. - #[clap(long, requires = "import-dump")] + #[clap(long, env = "MEILI_IGNORE_MISSING_DUMP", requires = "import-dump")] pub ignore_missing_dump: bool, /// Ignore the dump if a database already exists, and load that database instead. - #[clap(long, requires = "import-dump")] + #[clap(long, env = "MEILI_IGNORE_DUMP_IF_DB_EXISTS", requires = "import-dump")] pub ignore_dump_if_db_exists: bool, /// Folder where dumps are created when the dump route is called. From d0f1054f5c89ad1b3d2c3ed9d1895af75a485842 Mon Sep 17 00:00:00 2001 From: Guillaume Mourier Date: Thu, 1 Sep 2022 22:37:07 +0200 Subject: [PATCH 2/2] chore: cargo fmt --- meilisearch-http/src/option.rs | 12 ++++++++++-- 1 file changed, 10 insertions(+), 2 deletions(-) diff --git a/meilisearch-http/src/option.rs b/meilisearch-http/src/option.rs index 3ca967b0e..bdfa283a6 100644 --- a/meilisearch-http/src/option.rs +++ b/meilisearch-http/src/option.rs @@ -107,11 +107,19 @@ pub struct Opt { pub import_snapshot: Option, /// The engine will ignore a missing snapshot and not return an error in such case. - #[clap(long, env = "MEILI_IGNORE_MISSING_SNAPSHOT", requires = "import-snapshot")] + #[clap( + long, + env = "MEILI_IGNORE_MISSING_SNAPSHOT", + requires = "import-snapshot" + )] pub ignore_missing_snapshot: bool, /// The engine will skip snapshot importation and not return an error in such case. - #[clap(long, env = "MEILI_IGNORE_SNAPSHOT_IF_DB_EXISTS", requires = "import-snapshot")] + #[clap( + long, + env = "MEILI_IGNORE_SNAPSHOT_IF_DB_EXISTS", + requires = "import-snapshot" + )] pub ignore_snapshot_if_db_exists: bool, /// Defines the directory path where meilisearch will create snapshot each snapshot_time_gap.