Conversation
andreibancioiu
left a comment
There was a problem hiding this comment.
As discussed internally, we can separate "environments" from the existing configuration.
| return get_value("explorer_url") | ||
|
|
||
|
|
||
| @cache |
There was a problem hiding this comment.
Seems fine, because user cannot switch environments in a single invocation of mxpy. If that would happen (no support, though), this memoization would lead to bugs.
|
|
||
| def get_defaults() -> dict[str, Any]: | ||
| return { | ||
| "dependencies.vmtools.tag": "v1.5.24", |
There was a problem hiding this comment.
👍 for doing the cleanup.
| command "Environment.Set" "env set" | ||
| command "Environment.Get" "env get" | ||
| command "Environment.Dump" "env dump" | ||
| command "Environment.Switch" "env switch" |
There was a problem hiding this comment.
Switch sounds good. Though, about set & get, let's double check with @ccorcoveanu whether this is fine.
There was a problem hiding this comment.
get and set sound good (also git has get and set methods for config). what I am thinking is, do we need dump? Or should get without any arguments actually dump the active config?
There was a problem hiding this comment.
get without args dumping the entire config sounds good. I've done it with dump to match the mxpy config dump command.
| ) | ||
| sub.set_defaults(func=new_env) | ||
|
|
||
| sub = cli_shared.add_command_subparser(subparsers, "env", "get", "Gets an env value from the active environment.") |
There was a problem hiding this comment.
Maybe get-value instead of get and set-value instead of set? Just an opinion.
| command "Environment.Set" "env set" | ||
| command "Environment.Get" "env get" | ||
| command "Environment.Dump" "env dump" | ||
| command "Environment.Switch" "env switch" |
There was a problem hiding this comment.
get and set sound good (also git has get and set methods for config). what I am thinking is, do we need dump? Or should get without any arguments actually dump the active config?
|
|
||
|
|
||
| def dns_resolve(args: Any): | ||
| cli_shared.set_proxy_from_config_if_not_provided(args) |
There was a problem hiding this comment.
just a suggestion/question. This set_proxy_from_config_if_not_provided call in all of the handlers seem like something that will end up refactored at some point. I would suggest a higher order function or component which keeps these implementations clean without caring about configs. So whoever calls this higher in the stack will call -
handle(dns_resolve, args)
def handle(f, args):
args = fill(args)
f(args)
Added the possibility for user to create custom configs. Things like proxy url, explorer url, default hrp and whether or not to ask for confirmation before sending a transaction can be set in the config. In case
--proxyis not provided, the proxy will be fetched from the config.An user made config can look like this:
{ "default_address_hrp": "erd", "ask_confirmation": "false", "proxy_url": "https://devnet-gateway.multiversx.com", "explorer_url": "https://devnet-explorer.multiversx.com" }