More powerful API Configuration #1888
Merged
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Addresses the feature request: #1883
Notes, because I did not want to introduce a name conflict in the user scope (i.e. someone else is very likely using the name
configuration
as a helper), I renamed the param toapi_configuration
, I'm open to a better naming if possible.To read the PR and understand the changes: There's a certain complexity on distinguishing between the command running at pre-setup time (i.e when it's being parsed and stored on the main API for re-playing on mount time) and mount time. As such, I've introduced the LazyValue objects which remember how they were accessed, and know that they are lazy, therefore I can distinguish evaluated params from params that should only be evaluated at Mount-Time.
Because I was adding features to the configuration, I've decided to add 2 additional ones that seemed used, conditionally executing code based on a configuration (unfortunately a simple
if
block won't do on the main namespace as I cannot record the unevaluated value. i.e. I only know the response of theif
statement, but I can never see that there was an if statement )And arbitrary code on mount (that admitdly would take care of the conditional issue assuming you were happy to moving the code to that block).
Each part of this PR is open for discussion