-
Notifications
You must be signed in to change notification settings - Fork 787
New issue
Have a question about this project? # for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “#”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? # to your account
Allow unescaped quoted strings with --config CLI #2835
Allow unescaped quoted strings with --config CLI #2835
Conversation
0b9d4e1
to
5688c07
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Tested:
- node.active_elections_size
- node.httpcallback.address
- node.max_work_generate_multiplier
- node.work_peers
No regressions and all of them now work with unescaped quotes or even no quotes.
However noticed on arrays like node.work_peers
it's not possible to give --config node.work_peers=["127.0.0.1:7000"]
, the quotes must be escaped instead: --config node.work_peers=[\"127.0.0.1:7000\"]
.
Using the approach of this PR, can this case be handled? If not, LGTM but the documentation should note this particular case.
@guilhermelawless I have added support for arrays, thanks for finding that during testing. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Working great!
Could change some ss << "(char)"
to single quotes but not too important.
A note for documentation is that arrays must not have spaces in between entries.
This task was originally because of confusion around this error found by @guilhermelawless:
./nano_node --network live --daemon --config node.online_weight_minimum="40000000000000000000000000000000000000"
The docs state that strings should be escaped. Would be nice if non-escaped quotes could be done which is what this PR has added.
To solve this we are now separating the key and value, then appending them together with the value being surrounded in escaped quotations if they are not added by the command. Toml seems to be able to handle this fine based on various tests. Reviewers should test a variety of options with different types (bool/int/string for instance).