Dynamic config definitions and getter #788
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.
Summary
Creating the definition language for the app dynamic configurations.
Details
Dynamic config definition
It supports multiple ways of defining the source of the configuration value. The value source can be:
We can change the value source without affecting the way the value is consumed through the code.
Loading configurations
On the server start (using instrumentation hooks) configurations values/resolvers are transformed with
getTransformedConfigs
and loaded into memory into a global refConsuming values
getConfigValue
can be used to access the configurations securely on server and it doesn't leak any sensitive data if used by mistake on client.Global Configs ref
To secure the configuration values, configurations are loaded and shared within the server memory. This is done to break the imports flow between the loaders of the config and the consumers of it. With that all definitions & resolvers stays at the server while allowing to use the module safely on modules that works both on server/client.
server only module
Use server only to make sure definitions and resolvers are never imported to client code