-
Notifications
You must be signed in to change notification settings - Fork 3.7k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Add client config subcommand to CLI #8953
Conversation
This is important work @cyberbono3 |
client/config/toml.go
Outdated
tmos.MustWriteFile(configFilePath, buffer.Bytes(), 0644) | ||
return nil | ||
|
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.
MustWriteFile
is removed from future tendermint releases. I suggest adopting the following (and equivalent) form:
tmos.MustWriteFile(configFilePath, buffer.Bytes(), 0644) | |
return nil | |
return ioutil.WriteFile(configFilePath, buffer.Bytes(), 0644) |
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.
Done!
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.
Functionally, it works well!
I tested:
1. `node` set in client.toml, no flag: uses node from client.toml
2. `node` set in client.toml, with `--node` flag: uses node from flag
Left some comments about the code.
1af4dee
to
ff6eeeb
Compare
Codecov Report
@@ Coverage Diff @@
## master #8953 +/- ##
==========================================
- Coverage 58.96% 58.94% -0.03%
==========================================
Files 575 575
Lines 32159 32171 +12
==========================================
- Hits 18963 18962 -1
- Misses 10982 10995 +13
Partials 2214 2214
|
Benchmark beginning. Status page: https://github.orijtech.com/benchmark/status?commit=a889d7efe871565a16581f2e439aaac4121a0cc4 |
a889d7e
to
f885b5d
Compare
Benchmark beginning. Status page: https://github.orijtech.com/benchmark/status?commit=f885b5d6f57c70af2fed71630c5e8e73d4cb7b47 |
I run golangci-lint run |
At times new linter releases break with past releases. As a word of advice: instead of running |
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.
tACK, thanks @cyberbono3 for this PR!
I tested:
simd config
simd config node
simd config node "some value" # set some real node
simd q staking validators # uses node from config file
simd q staking validators --node # uses node from flag
simd config node "some value" --home ~/.test # changes value in ~/.test
simd q staking validators --home ~/.test # uses node from ~/.test config file
I left some cosmetic changes suggestions.
./build/simd init andrei --home ./test | ||
cd test/config there is no client.toml configuration file | ||
*/ | ||
func ReadHomeFlag(clientCtx Context, cmd *cobra.Command) Context { |
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.
Can L96-L99 call this function too?
eeca868
to
fc5b76a
Compare
Benchmark beginning. Status page: https://github.orijtech.com/benchmark/status?commit=fc5b76a9aeb6e3bd800ae6b33c9ea58b1641b3ff |
Benchmark finished. See the result: https://github.orijtech.com/benchmark/result?id=d40aaeabf0b44e7aab19a368c7618c7a |
Benchmark finished. See the result: https://github.orijtech.com/benchmark/result?id=f5c829c39c1a459581f2b427710d31d4 |
Benchmark beginning. Status page: https://github.orijtech.com/benchmark/status?commit=32b2d153507d8ee02ce03dc44cf0ba0335283f08 |
@cyberbono3 Could you fix the tests? I believe the PR's almost ready to be merged! |
9e97433
to
d6f55a4
Compare
The rosetta test needs to be fixed #8772 Putting automerge on then! |
@Mergifyio backport release/v0.42.x |
Command
|
* add client config * addressed reviewers comments * refactored,ready for review * fixed linter issues and addressed reviewers comments * Bump golangci-lint * fix linter warnings * fix some tests Co-authored-by: Alessio Treglia <[email protected]> Co-authored-by: Amaury <[email protected]>
* Add client config subcommand to CLI (#8953) * add client config * addressed reviewers comments * refactored,ready for review * fixed linter issues and addressed reviewers comments * Bump golangci-lint * fix linter warnings * fix some tests Co-authored-by: Alessio Treglia <[email protected]> Co-authored-by: Amaury <[email protected]> * Fix build Co-authored-by: Andrei Ivasko <[email protected]> Co-authored-by: Alessio Treglia <[email protected]>
* add client config * addressed reviewers comments * refactored,ready for review * fixed linter issues and addressed reviewers comments * Bump golangci-lint * fix linter warnings * fix some tests Co-authored-by: Alessio Treglia <[email protected]> Co-authored-by: Amaury <[email protected]>
Description
This PR implements the first step from Amaury's proposal.
$NODE_DIR/config/client.toml
file to hold all client-side configuration (chainID, keyringBackend, output, node, broadcastMode)./build/simd config node tcp://localhost:127
)./build/simd config node
returnstcp://localhost:127
)./build/simd config
)Output:
{ "chain-id": "chain-7e7zGq","keyring-backend": "test", "output": "json","node": "tcp://localhost:26657","broadcast-mode": "async"}
Me and @clevinson made manual testing. I can make some automatic tests if needed in a separate PR.
closes: #8529
Before we can merge this PR, please make sure that all the following items have been
checked off. If any of the checklist items are not applicable, please leave them but
write a little note why.
docs/
) or specification (x/<module>/spec/
)godoc
comments.Unreleased
section inCHANGELOG.md
Files changed
in the Github PR explorerCodecov Report
in the comment section below once CI passes