-
Notifications
You must be signed in to change notification settings - Fork 47
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
Instant On Documenation - Behavior of config property when no default value is set #6970
Comments
Hi @anjumfatima90 - is there a development epic associated with this update? If so, what is the target release? Thanks |
Hi @dmuelle - Please ignore the above content. Updated content is as below. This content is related to the existing functionalities and they is no target release associated with it and it should probably go under https://openliberty.io/docs/latest/instanton-limitations.html#mp-config The configuration property can be introduced inside the application in two ways: either statically through When statically injecting a property, it is necessary to define a default value for it in microprofile-config.properties or by employing a variable with a defaultValue in server.xml. The actual value can be assigned via server.env or by altering the server.xml configuration after the checkpoint. However, it's important to note that using server.env to supply configuration values before the checkpoint is restricted. If you use environment variables for configuration values before the checkpoint, you may encounter a configuration exception, specifically, To prevent this exception, you can set a default value for the statically injected property in microprofile-config.properties, a variable with a defaultValue within the server.xml, or by utilizing defaultValue within the @ConfigProperty annotation. Additionally, you can inject the configuration property using static In cases where an application includes early startup code and you are using the afterAppStart checkpoint option, attempting to access the configuration property injected with @tjwatson please review the above content and kindly let me know if I have missed anything here. |
I think we need some examples that use the annotations for injecting config, we have static, static-optional, dynamic and dynamic-optional: @Inject
@ConfigProperty(name = "static_config")
String staticConfig;
@Inject
@ConfigProperty(name = "static_optional_config")
Optional<String> staticOptionalConfig;
@Inject
@ConfigProperty(name = "dynamic_config")
Provider<String> dynamicConfig;
@Inject
@ConfigProperty(name = "dynamic_optional_config")
Provider<Optional<String>> dynamicOptionalConfig; The non-optional ones above named
We should not mention updating the
We need to phrase the in a more general way that doesn't mention environment variables because this can happen if there is simply no default value to be found. Something like:
This error can be avoided by providing a default value for the configuration key in one of the following ways:
@Inject
@ConfigProperty(name = "static_config", defaultValue = "defaultValue")
String staticConfig;
@Inject
@ConfigProperty(name = "dynamic_config", defaultValue = "defaultValue")
Provider<String> dynamicConfig;
<variable name="static_config" defaultValue="defaultValue" />
<variable name="dynamic_config" defaultValue="defaultValue" /> The "defaultValue" can then be overridden on restore by configuring the value with an environment variable or values from the variable source directory. Caution is needed for CDI beans that are
Furthermore, if the @anjumfatima90 I would like you to take a look at updating the limitations doc with this information at https://github.com/OpenLiberty/docs/blob/vNext/modules/ROOT/pages/instanton-limitations.adoc then we can do a technical review before handing it over to @dmuelle to do a doc review. |
Hi @anjumfatima90 @tjwatson - looking over these comments to include this update with the 23.0.0.11 release. Are you planning to submit an initial draft of the update? Let me know how I help. I can get started based on these comments or happy to review any proposed updates when you have them ready. FYI our doc freeze for this release is 11/9 so we need the proposed content at least a week before that (~11/2) to make sure we can get everything sorted for the release. Thanks |
I'm hoping to have @anjumfatima90 look at doing the initial draft. Note that this isn't to document new behavior for 23.0.0.11. Rather it is to document existing behavior from 23.0.0.6. |
The config property when no default value is set and the value is updated after checkpoint before restore.
Scenario 1: Config property is accessed early during checkpoint.
Result: A warning CWWKC0651W is logged to let the user know that the updated value of the property might not be used
during restore.
Scenario 2: Config property is NOT accessed early during checkpoint.
Result: The updated config value should be used on restore.
The text was updated successfully, but these errors were encountered: