-
Notifications
You must be signed in to change notification settings - Fork 428
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #3439 from esl/auth-password-config
Introduce defaults in the auth section **Goal:** POC of defaults for nested options in an optional section to see how they would look like and decide if we want to proceed with this approach for the whole configuration file. **Scope:** Defaults for `methods`, `sasl_mechanisms` and `sasl_external` in the `auth` section. **Motivation** - advantages of defaults: - Easy to find the default value in the code. - Simpler code for fetching the values. - No need to recompute larger values like the default list of SASL mechanisms every time they are fetched. **Challenges:** - Optional sections (like `auth`) need to be always included to make the defaults present. This cannot be a universal rule as most sections need to be included only when particular features are enabled. - Small tests: nested values need to be checked selectively instead of comparing the whole configuration terms. However, this seems like a general improvement and the test cases look cleaner afterwards. - Small tests: defaults need to be inserted into the expected options for the file tests. To fix this, the last commit changes the static `*.options` files into dynamic lists created by Erlang code. This seems to provide more flexibility, but you can check the last commit and see if you like the new, less verbose version more. See the commit messages for more details. **Comments** > Hmm... don't know if it is too late for this idea, but the fact that we'd have defaults for entire sections seems to make some things more verbose 🤔 Didn't we consider setting these defaults per-option It's a good idea and actually this **was** my initial attempt of the POC that I summarized at a grooming when I was introducing the whole concept of defaults. However, implementation for the `general` section showed the following issues: - The `default` would work if we are in a section, but would make no sense if we are not in a section, so you would always need to go one level up (which is tricky) to verify if it makes sense or not - Sections have defaults only if they are not in `host_config` and having the defaults scattered around would mean a lot of extra code to have the second version for `host_config` without the defaults (see the code for the `general` section). - Parser code was more complicated. - Defaults should be defined at the same level as `required` keys.
- Loading branch information
Showing
15 changed files
with
776 additions
and
1,064 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file was deleted.
Oops, something went wrong.
Oops, something went wrong.