Skip to content
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

algocfg: Add print option to algocfg. #5824

Merged
merged 7 commits into from Nov 13, 2023

Conversation

winder
Copy link
Contributor

@winder winder commented Nov 9, 2023

Summary

I frequently want to tell people a default configuration according to algocfg, but the only way to use it involves updating/creating a file in the data directory.

This PR adds a new algocfg profile print <profile> subcommand that writes configuration to stdout instead of to a regular file.

Test Plan

Manual testing:

$ algocfg profile print relay
{
	"Archival": true,
	"NetAddress": ":4160",
	"EnableLedgerService": true,
	"EnableBlockService": true
}
$ algocfg profile print conduit
{
	"CatchupParallelBlocks": 64,
	"MaxAcctLookback": 64,
	"EnableFollowMode": true
}
$ algocfg profile print participation
{
}
$ algocfg profile print development
{
	"EnableDeveloperAPI": true,
	"MaxAcctLookback": 256,
	"EnableExperimentalAPI": true,
	"EnableTxnEvalTracer": true,
	"DisableAPIAuth": true
}

@winder winder self-assigned this Nov 9, 2023
@winder winder changed the title Add print option to algocfg. algocfg: Add print option to algocfg. Nov 9, 2023
@winder winder marked this pull request as ready for review November 9, 2023 15:17
Copy link

codecov bot commented Nov 9, 2023

Codecov Report

Merging #5824 (6a7af22) into master (c1207a4) will increase coverage by 0.09%.
Report is 6 commits behind head on master.
The diff coverage is 51.42%.

@@            Coverage Diff             @@
##           master    #5824      +/-   ##
==========================================
+ Coverage   55.61%   55.71%   +0.09%     
==========================================
  Files         475      475              
  Lines       66909    66916       +7     
==========================================
+ Hits        37212    37280      +68     
+ Misses      27182    27109      -73     
- Partials     2515     2527      +12     
Files Coverage Δ
config/localTemplate.go 72.02% <100.00%> (ø)
cmd/algocfg/resetCommand.go 10.52% <0.00%> (ø)
cmd/algocfg/setCommand.go 9.37% <0.00%> (ø)
util/codecs/json.go 68.46% <72.72%> (+56.96%) ⬆️
cmd/algocfg/profileCommand.go 37.33% <10.00%> (-3.58%) ⬇️

... and 11 files with indirect coverage changes

📣 Codecov offers a browser extension for seamless coverage viewing on GitHub. Try it in Chrome or Firefox today!

jasonpaulos
jasonpaulos previously approved these changes Nov 9, 2023
Copy link
Member

@jasonpaulos jasonpaulos left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks good and makes sense. I left a comment about a nit, but I don't consider that a blocker. If that error comes up in the future it can always be addressed then.

cmd/algocfg/profileCommand.go Outdated Show resolved Hide resolved
jasonpaulos
jasonpaulos previously approved these changes Nov 9, 2023
Copy link
Contributor

@gmalouf gmalouf left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think anything we are adding that is reusable across go-algorand should get basic testing, so in this case json.go could use a smoke test.

@winder winder requested a review from gmalouf November 13, 2023 15:57
@winder winder merged commit 90b10d2 into algorand:master Nov 13, 2023
18 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

4 participants