Skip to content

Conversation

@radik878
Copy link

This PR implements the suggestion to reduce calls to the CLI config loader by introducing a single, lazy, global configuration. As discussed in issue refactor: reduce calls for load_config_file in CLI link and related comments in the bech32 PR thread link, repeatedly reading miden-client.toml in various commands is unnecessary and can be error-prone. I added a get_cli_config() accessor backed by std::sync::OnceLock that loads the config exactly once from the current working directory and then returns a shared reference. All commands that previously called load_config_file() now use get_cli_config(), including startup in lib.rs, info.rs, account.rs, new_transactions.rs, and new_account.rs. I also refactored load_faucet_details_map() to use the global config instead of reloading from disk and removed the old load_config_file() helper entirely. This change reduces disk I/O, simplifies function signatures in call sites, and keeps behavior unchanged; config parsing errors still surface early and thread-safely.

fix #857

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

refactor: reduce calls for load_config_file in CLI

1 participant