oscerd commented on code in PR #2091:
URL:
https://github.com/apache/camel-spring-boot/pull/2091#discussion_r4584086923
##########
core/camel-spring-boot/src/main/java/org/apache/camel/spring/boot/AbstractEarlyResolutionPropertiesParser.java:
##########
@@ -75,6 +75,13 @@ public abstract class AbstractEarlyResolutionPropertiesParser
*/
protected abstract PropertiesFunction
createPropertiesFunction(ConfigurableEnvironment environment);
+ /**
+ * Releases what the properties function holds, such as the login of its
client, once the properties are resolved,
+ * also when they could not be. Does nothing by default.
+ */
+ protected void release(PropertiesFunction propertiesFunction) {
Review Comment:
Filed as [CAMEL-27024](https://issues.apache.org/jira/browse/CAMEL-27024),
linked to CAMEL-26919, for the AWS and GCP parsers (and a check of the others).
_Claude Code on behalf of oscerd_
##########
components-starter/camel-hashicorp-vault-starter/src/main/java/org/apache/camel/component/hashicorp/vault/springboot/SpringBootHashicorpVaultPropertiesParser.java:
##########
@@ -40,35 +48,62 @@ protected String getOverridePropertySourceName() {
@Override
protected PropertiesFunction
createPropertiesFunction(ConfigurableEnvironment environment) {
- String token = required(environment, "camel.vault.hashicorp.token",
"Hashicorp Vault token is required");
- String host = required(environment, "camel.vault.hashicorp.host",
"Hashicorp Vault host is required");
- String portValue = required(environment, "camel.vault.hashicorp.port",
"Hashicorp Vault port is required");
- String scheme = required(environment, "camel.vault.hashicorp.scheme",
"Hashicorp Vault scheme is required");
-
- int port;
+ // bound as Spring Boot binds the options of the CamelContext, such as
camel.vault.hashicorp.role-id
+ HashicorpVaultConfiguration configuration = Binder.get(environment)
+ .bind(PREFIX, HashicorpVaultConfiguration.class)
+ .orElseGet(HashicorpVaultConfiguration::new);
+ if (isTokenLogin(configuration)) {
Review Comment:
Partly done: the login-specific check (`isTokenLogin` and the token) is
gone. Camel's check of the login now reports a missing token, or any other
setting of the login, and the parser wraps its message with the options. I kept
the host, port and scheme checks: they do not depend on the login, and they
name the exact property (and now the environment variable), as the existing
tests expect.
_Claude Code on behalf of oscerd_
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]