Disable TUI on binary launch (#3818)
* adding --no-tui * revert next line * english comments * bin: more detailed no-tui flag description --------- Co-authored-by: Jörg Wieschebrock <Joerg.Wieschebrock@krone.de>
This commit is contained in:
+20
-1
@@ -87,7 +87,7 @@ fn real_main() -> i32 {
|
||||
let args = App::from_yaml(yml)
|
||||
.version(built_info::PKG_VERSION)
|
||||
.get_matches();
|
||||
let node_config;
|
||||
let mut node_config;
|
||||
|
||||
let chain_type = if args.is_present("testnet") {
|
||||
global::ChainTypes::Testnet
|
||||
@@ -136,6 +136,25 @@ fn real_main() -> i32 {
|
||||
let mut logging_config = config.members.as_ref().unwrap().logging.clone().unwrap();
|
||||
logging_config.tui_running = config.members.as_ref().unwrap().server.run_tui;
|
||||
|
||||
// Handle global --no-tui flag and GRIN_NO_TUI environment variable
|
||||
let no_tui = args.is_present("no-tui")
|
||||
|| std::env::var("GRIN_NO_TUI")
|
||||
.map(|v| v == "1" || v.eq_ignore_ascii_case("true"))
|
||||
.unwrap_or(false);
|
||||
|
||||
if no_tui {
|
||||
// Deactivate logger TUI
|
||||
logging_config.tui_running = Some(false);
|
||||
|
||||
// Deactivate Server TUI in node config, so
|
||||
// cmd::server_command(...) will not use it
|
||||
if let Some(gc) = node_config.as_mut() {
|
||||
if let Some(members) = gc.members.as_mut() {
|
||||
members.server.run_tui = Some(false);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
let api_chan: &'static mut (oneshot::Sender<()>, oneshot::Receiver<()>) =
|
||||
Box::leak(Box::new(oneshot::channel::<()>()));
|
||||
|
||||
|
||||
@@ -11,6 +11,10 @@ args:
|
||||
help: Run grin as a local-only network. Doesn't block peer connections but will not connect to any peer or seed
|
||||
long: usernet
|
||||
takes_value: false
|
||||
- no-tui:
|
||||
help: Disable the interactive TUI ignoring configuration file value (force log-only mode)
|
||||
long: no-tui
|
||||
takes_value: false
|
||||
subcommands:
|
||||
- clean:
|
||||
about: Clean Grin chain data
|
||||
|
||||
Reference in New Issue
Block a user