From 51bbb3cb0034698ed9572b6bb28d22b51622bd1b Mon Sep 17 00:00:00 2001 From: as51340 Date: Wed, 22 Apr 2026 10:44:09 +0200 Subject: [PATCH 1/2] feat: Define new default value for --history flag --- src/main.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/main.cpp b/src/main.cpp index 4ede8b96..389ba361 100644 --- a/src/main.cpp +++ b/src/main.cpp @@ -91,7 +91,7 @@ DEFINE_bool(csv_doublequote, true, "If `csv-doublequote` is false, 'csv-escapechar' must be set."); // history -DEFINE_string(history, "~/.memgraph", "Use the specified directory to save history."); +DEFINE_string(history, "/tmp/.memgraph", "Use the specified directory to save history."); // Use /tmp because in K8s deployments users want to have read-only root filesystem. Folder /home/memgraph is part then of the root fileystem and hence read-only DEFINE_bool(no_history, false, "Do not save history."); DEFINE_string( From 9283dee716a45a4e59ae10a2c923aa019c6e11df Mon Sep 17 00:00:00 2001 From: as51340 Date: Wed, 22 Apr 2026 13:22:28 +0200 Subject: [PATCH 2/2] feat: Use env variable MGCONSOLE_HISTORY_PATH --- src/main.cpp | 12 ++++++++++-- 1 file changed, 10 insertions(+), 2 deletions(-) diff --git a/src/main.cpp b/src/main.cpp index 389ba361..2aeb28ab 100644 --- a/src/main.cpp +++ b/src/main.cpp @@ -19,6 +19,7 @@ #include #include +#include #include #include #include @@ -91,7 +92,7 @@ DEFINE_bool(csv_doublequote, true, "If `csv-doublequote` is false, 'csv-escapechar' must be set."); // history -DEFINE_string(history, "/tmp/.memgraph", "Use the specified directory to save history."); // Use /tmp because in K8s deployments users want to have read-only root filesystem. Folder /home/memgraph is part then of the root fileystem and hence read-only +DEFINE_string(history, "~/.memgraph", "Use the specified directory to save history."); DEFINE_bool(no_history, false, "Do not save history."); DEFINE_string( @@ -188,7 +189,14 @@ int main(int argc, char **argv) { }; if (console::is_a_tty(STDIN_FILENO)) { // INTERACTIVE - return mode::interactive::Run(bolt_config, FLAGS_history, FLAGS_no_history, FLAGS_verbose_execution_info, csv_opts, + auto const history_file = std::invoke([&]() -> std::string { + if (const char *env_file = std::getenv("MGCONSOLE_HISTORY_PATH")) { + return env_file; + } + return FLAGS_history; + }); + + return mode::interactive::Run(bolt_config, history_file, FLAGS_no_history, FLAGS_verbose_execution_info, csv_opts, output_opts); } else if (FLAGS_import_mode == constants::kParserMode) { return mode::parsing::Run(FLAGS_collect_parser_stats, FLAGS_print_parser_stats);