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

feat: Allow app developers to override default appConfig template #9550

Merged
merged 22 commits into from
Jun 23, 2021

Conversation

anilcse
Copy link
Collaborator

@anilcse anilcse commented Jun 21, 2021

Description

Closes: #5540


Author Checklist

All items are required. Please add a note to the item if the item is not applicable and
please add links to any relevant follow up issues.

I have...

  • included the correct type prefix in the PR title
  • added ! to the type prefix if API or client breaking change
  • targeted the correct branch (see PR Targeting)
  • provided a link to the relevant issue or specification
  • followed the guidelines for building modules
  • included the necessary unit and integration tests
  • added a changelog entry to CHANGELOG.md
  • included comments for documenting Go code
  • updated the relevant documentation or specification
  • reviewed "Files changed" and left comments if necessary
  • confirmed all CI checks have passed

Reviewers Checklist

All items are required. Please add a note if the item is not applicable and please add
your handle next to the items reviewed if you only reviewed selected items.

I have...

  • confirmed the correct type prefix in the PR title
  • confirmed ! in the type prefix if API or client breaking change
  • confirmed all author checklist items have been addressed
  • reviewed state machine logic
  • reviewed API design and naming
  • reviewed documentation is accurate
  • reviewed tests and test coverage
  • manually tested (if applicable)

@fedekunze
Copy link
Collaborator

oh this is very handy! Thanks @anilcse! We had to fork the config and server in order to add support for the JSON-RPC. lmk if you need additional reviews. cc: @khoslaventures

@codecov
Copy link

codecov bot commented Jun 21, 2021

Codecov Report

Merging #9550 (28a13df) into master (899b097) will increase coverage by 0.01%.
The diff coverage is 80.76%.

❗ Current head 28a13df differs from pull request most recent head 145b4be. Consider uploading reports for the commit 145b4be to get more accurate results
Impacted file tree graph

@@            Coverage Diff             @@
##           master    #9550      +/-   ##
==========================================
+ Coverage   60.60%   60.61%   +0.01%     
==========================================
  Files         589      589              
  Lines       37236    37256      +20     
==========================================
+ Hits        22567    22583      +16     
- Misses      12726    12730       +4     
  Partials     1943     1943              
Impacted Files Coverage Δ
server/config/toml.go 13.33% <0.00%> (-4.85%) ⬇️
simapp/simd/cmd/root.go 66.89% <100.00%> (+5.17%) ⬆️
x/authz/keeper/keeper.go 66.93% <0.00%> (-1.04%) ⬇️

@anilcse anilcse marked this pull request as ready for review June 21, 2021 08:38
@anilcse anilcse changed the title Allow app developers to override default appConfig template feat: Allow app developers to override default appConfig template Jun 21, 2021
@anilcse anilcse changed the title feat: Allow app developers to override default appConfig template !feat: Allow app developers to override default appConfig template Jun 21, 2021
@anilcse anilcse changed the title !feat: Allow app developers to override default appConfig template feat: Allow app developers to override default appConfig template Jun 21, 2021
@anilcse anilcse changed the title feat: Allow app developers to override default appConfig template !feat: Allow app developers to override default appConfig template Jun 21, 2021
@anilcse anilcse added the T: Dev UX UX for SDK developers (i.e. how to call our code) label Jun 21, 2021
Copy link
Collaborator

@fedekunze fedekunze left a comment

Choose a reason for hiding this comment

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

Can you try running the server with the custom config? Usually, that's the part that involves the most changes when adding a custom config. See

https://github.com/tharsis/ethermint/blob/d8926636e7645e1a95f8bab409fd1118a58bfd1d/cmd/ethermintd/start.go#L241

simapp/simd/cmd/root.go Outdated Show resolved Hide resolved
@anilcse
Copy link
Collaborator Author

anilcse commented Jun 21, 2021

Can you try running the server with the custom config? Usually, that's the part that involves the most changes when adding a custom config. See

https://github.com/tharsis/ethermint/blob/d8926636e7645e1a95f8bab409fd1118a58bfd1d/cmd/ethermintd/start.go#L241

You meant for adding a new server? This PR only deals with extra config settings (overriding app.toml). We would need to implement your modular server ADR for configuring new servers.

@lgtm-com
Copy link

lgtm-com bot commented Jun 21, 2021

This pull request introduces 1 alert when merging 17db7b4 into 6a5a2de - view on LGTM.com

new alerts:

  • 1 for Useless assignment to local variable

@lgtm-com
Copy link

lgtm-com bot commented Jun 21, 2021

This pull request introduces 1 alert when merging 9cd2021 into 6a5a2de - view on LGTM.com

new alerts:

  • 1 for Useless assignment to local variable

@lgtm-com
Copy link

lgtm-com bot commented Jun 21, 2021

This pull request introduces 1 alert when merging 7a5a3ad into 304d0ff - view on LGTM.com

new alerts:

  • 1 for Useless assignment to local variable

Copy link
Contributor

@alexanderbez alexanderbez left a comment

Choose a reason for hiding this comment

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

utACK. Nice work @anilcse 👍

server/config/toml.go Show resolved Hide resolved
server/util.go Outdated Show resolved Hide resolved
@@ -75,6 +79,43 @@ func NewRootCmd() (*cobra.Command, params.EncodingConfig) {
return rootCmd, encodingConfig
}

// initConfig helps to override default appConfig template and settings.
// return; if no custom configuration is required for the application.
func initConfig() (string, interface{}) {
Copy link
Member

Choose a reason for hiding this comment

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

could you add a few short sentences in the docs about this please.

Copy link
Member

Choose a reason for hiding this comment

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

oh sorry, meant the docs/ directory. I see you added in the doc.go.

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

I didn't find a relavant place to add it actually. There are no docs explaining server configs. May be I will add a new file or a new section under node docs.

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

updated rootCmd section docs

@anilcse anilcse requested a review from tac0turtle June 21, 2021 17:28
@anilcse anilcse changed the title !feat: Allow app developers to override default appConfig template feat: Allow app developers to override default appConfig template Jun 22, 2021
Copy link
Member

@tac0turtle tac0turtle left a comment

Choose a reason for hiding this comment

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

Amazing thank you

Copy link
Collaborator

@fedekunze fedekunze left a comment

Choose a reason for hiding this comment

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

ACK. Would be great to add include this in v0.43

@fedekunze fedekunze added the A:automerge Automatically merge PR once all prerequisites pass. label Jun 23, 2021
@mergify mergify bot merged commit 1c77766 into master Jun 23, 2021
@mergify mergify bot deleted the anil/configurable_appconfig branch June 23, 2021 08:42
@@ -75,6 +78,45 @@ func NewRootCmd() (*cobra.Command, params.EncodingConfig) {
return rootCmd, encodingConfig
}

// initAppConfig helps to override default appConfig template and configs.
// return "", nil if no custom configuration is required for the application.
func initAppConfig() (string, interface{}) {
Copy link
Member

Choose a reason for hiding this comment

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

@anilcse do you think this could be reused to override tendermint config.toml?

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

I believe we can do that. I will look into it tomorrow and create a PR

Copy link
Member

Choose a reason for hiding this comment

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

larry0x pushed a commit to larry0x/cosmos-sdk that referenced this pull request May 22, 2023
…smos#9550)

<!--
The default pull request template is for types feat, fix, or refactor.
For other templates, add one of the following parameters to the url:
- template=docs.md
- template=other.md
-->

## Description

Closes: cosmos#5540

<!-- Add a description of the changes that this PR introduces and the files that
are the most critical to review. -->

---

### Author Checklist

*All items are required. Please add a note to the item if the item is not applicable and
please add links to any relevant follow up issues.*

I have...

- [x] included the correct [type prefix](https://github.com/commitizen/conventional-commit-types/blob/v3.0.0/index.json) in the PR title
- [ ] added `!` to the type prefix if API or client breaking change
- [x] targeted the correct branch (see [PR Targeting](https://github.com/cosmos/cosmos-sdk/blob/master/CONTRIBUTING.md#pr-targeting))
- [x] provided a link to the relevant issue or specification
- [ ] followed the guidelines for [building modules](https://github.com/cosmos/cosmos-sdk/blob/master/docs/building-modules)
- [ ] included the necessary unit and integration [tests](https://github.com/cosmos/cosmos-sdk/blob/master/CONTRIBUTING.md#testing)
- [ ] added a changelog entry to `CHANGELOG.md`
- [x] included comments for [documenting Go code](https://blog.golang.org/godoc)
- [x] updated the relevant documentation or specification
- [x] reviewed "Files changed" and left comments if necessary
- [x] confirmed all CI checks have passed

### Reviewers Checklist

*All items are required. Please add a note if the item is not applicable and please add
your handle next to the items reviewed if you only reviewed selected items.*

I have...

- [ ] confirmed the correct [type prefix](https://github.com/commitizen/conventional-commit-types/blob/v3.0.0/index.json) in the PR title
- [ ] confirmed `!` in the type prefix if API or client breaking change
- [ ] confirmed all author checklist items have been addressed 
- [ ] reviewed state machine logic
- [ ] reviewed API design and naming
- [ ] reviewed documentation is accurate
- [ ] reviewed tests and test coverage
- [ ] manually tested (if applicable)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
A:automerge Automatically merge PR once all prerequisites pass. T: Dev UX UX for SDK developers (i.e. how to call our code)
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Allow override the app.toml template.
4 participants