[
https://issues.apache.org/jira/browse/CAMEL-27069?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel
]
Work on CAMEL-27069 started by Claus Ibsen.
-------------------------------------------
> camel-main - an environment variable with underscores between the words of an
> option, such as CAMEL_VAULT_GCP_SERVICE_ACCOUNT_KEY, fails the startup
> ----------------------------------------------------------------------------------------------------------------------------------------------------
>
> Key: CAMEL-27069
> URL: https://issues.apache.org/jira/browse/CAMEL-27069
> Project: Camel
> Issue Type: Bug
> Components: camel-main
> Reporter: Claus Ibsen
> Assignee: Claus Ibsen
> Priority: Major
> Fix For: 4.24.0
>
>
> camel-main binds OS environment variables to its options by turning each
> {{_}} into a dot, for example {{CAMEL_MAIN_SHUTDOWNTIMEOUT}} to
> {{camel.main.shutdowntimeout}}. An option name with more than one word
> therefore has to be written without underscores
> ({{CAMEL_VAULT_GCP_SERVICEACCOUNTKEY}}).
> The vault components document their environment variables with underscores
> between the words, and read them with {{System.getenv}}:
> * {{CAMEL_VAULT_GCP_SERVICE_ACCOUNT_KEY}}, {{CAMEL_VAULT_GCP_PROJECT_ID}},
> {{CAMEL_VAULT_GCP_USE_DEFAULT_INSTANCE}}
> * {{CAMEL_VAULT_AWS_ACCESS_KEY}}, {{CAMEL_VAULT_AWS_SECRET_KEY}},
> {{CAMEL_VAULT_AWS_PROFILE_NAME}}, ...
> * {{CAMEL_VAULT_AZURE_TENANT_ID}}, {{CAMEL_VAULT_AZURE_CLIENT_ID}},
> {{CAMEL_VAULT_AZURE_VAULT_NAME}}, ...
> * {{CAMEL_VAULT_IBM_SERVICE_URL}},
> {{CAMEL_VAULT_IBM_EVENTSTREAM_BOOTSTRAP_SERVERS}}, ...
> * {{CAMEL_VAULT_CYBERARK_API_KEY}}
> camel-main also picks these up, as they start with {{CAMEL_VAULT_}}, and
> binds {{CAMEL_VAULT_GCP_SERVICE_ACCOUNT_KEY}} as
> {{camel.vault.gcp.service.account.key}}. A camel-main application with one of
> these variables set fails at startup:
> {noformat}
> java.lang.IllegalArgumentException: Cannot find getter method: service on
> bean: class org.apache.camel.vault.GcpVaultConfiguration when binding
> property: service.account.key
> {noformat}
> The {{CAMEL_COMPONENT_*}}, {{CAMEL_DATAFORMAT_*}} and {{CAMEL_LANGUAGE_*}}
> variables do not have this problem: the underscores in the option name are
> optional there ({{CAMEL_COMPONENT_KAFKA_BROKERS_LIST}} and
> {{CAMEL_COMPONENT_KAFKA_BROKERSLIST}} both work).
> Fix: camel-main knows its option keys from its metadata. Map an environment
> variable to the option whose key matches it when the underscores are ignored,
> so {{CAMEL_VAULT_GCP_SERVICE_ACCOUNT_KEY}} and
> {{CAMEL_VAULT_GCP_SERVICEACCOUNTKEY}} both set
> {{camel.vault.gcp.serviceAccountKey}}, and {{CAMEL_MAIN_SHUTDOWN_TIMEOUT}}
> sets {{camel.main.shutdownTimeout}}. Variables that match no option keep the
> current mapping.
> _Claude Code on behalf of davsclaus_
--
This message was sent by Atlassian Jira
(v10.3.26#10030026)