From 251bb84a26f3a2fa3b09f11f7c8591ea0ca0a9d8 Mon Sep 17 00:00:00 2001
From: librelois <c@elo.tf>
Date: Sun, 23 May 2021 02:33:00 +0200
Subject: [PATCH] feat(cli): re-expose node option --max-old-space-size

---
 rust-bins/duniter-cli/src/duniter_ts_args.rs | 6 +++++-
 rust-bins/duniter-cli/src/main.rs            | 2 ++
 2 files changed, 7 insertions(+), 1 deletion(-)

diff --git a/rust-bins/duniter-cli/src/duniter_ts_args.rs b/rust-bins/duniter-cli/src/duniter_ts_args.rs
index a190d4eb0..765630419 100644
--- a/rust-bins/duniter-cli/src/duniter_ts_args.rs
+++ b/rust-bins/duniter-cli/src/duniter_ts_args.rs
@@ -43,7 +43,11 @@ pub(crate) fn gen_duniter_ts_args(
     duniter_js_exe: String,
     log_level_filter: log::LevelFilter,
 ) -> Vec<String> {
-    let mut duniter_ts_args = vec!["--max-old-space-size=4096".to_owned(), duniter_js_exe];
+    let max_old_space_size = args.max_old_space_size.unwrap_or(4096);
+    let mut duniter_ts_args = vec![
+        format!("--max-old-space-size={}", max_old_space_size),
+        duniter_js_exe,
+    ];
     if let Some(ref home) = args.home {
         duniter_ts_args.push("--home".to_owned());
         duniter_ts_args.push(home.to_str().expect("invalid home path").to_owned());
diff --git a/rust-bins/duniter-cli/src/main.rs b/rust-bins/duniter-cli/src/main.rs
index f10642420..cdab0d8d3 100644
--- a/rust-bins/duniter-cli/src/main.rs
+++ b/rust-bins/duniter-cli/src/main.rs
@@ -64,6 +64,8 @@ struct DuniterArgs {
     /// Logs level (If not specified, use the logs level defined in the configuration or INFO by default).
     #[structopt(short, long, alias("loglevel"), case_insensitive(true), possible_values = &["OFF", "ERROR", "WARN", "INFO", "DEBUG", "TRACE"])]
     log: Option<log::LevelFilter>,
+    #[structopt(long, hidden = true)]
+    max_old_space_size: Option<usize>,
     /// Profile name (default "duniter_default")
     #[structopt(short, long, alias("mdb"))]
     profile: Option<String>,
-- 
GitLab