Skip to content

Commit

Permalink
[chore] Add rules for NewDefault* pattern (#9640)
Browse files Browse the repository at this point in the history
**Description:** 
Adds new rules for configuration packages and a `NewDefault*` function
to enable backwards-compatible use of the configuration.

**Link to tracking Issue:** 
Related to
#9508
  • Loading branch information
TylerHelmuth committed Feb 27, 2024
1 parent c205cc5 commit 1eee198
Showing 1 changed file with 5 additions and 0 deletions.
5 changes: 5 additions & 0 deletions CONTRIBUTING.md
Original file line number Diff line number Diff line change
Expand Up @@ -278,6 +278,11 @@ and should be followed.

Within the project, there are some packages that are yet to follow the recommendations and are being address, however, any new code should adhere to the recommendations.

### Default Configuration

To guarantee backwards compatible behavior, all configuration packages should supply a `NewDefault[config name]` functions that create a default version of the config. The package does not need to guarantee that `NewDefault[config name]` returns a usable configuration, only that default values will be set. For example, if the configuration requires that a field, such as `Endpoint` be set, but there is no valid default value, then `NewDefault[config name]` may set that value to `""` with the expectation that the user will set a valid value.

Users should always initialize the config struct with this function and overwrite anything as needed.

### Startup Error Handling

Expand Down

0 comments on commit 1eee198

Please sign in to comment.