You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@camel.apache.org by "Gonçalo Pereira (Jira)" <ji...@apache.org> on 2021/03/12 15:14:00 UTC

[jira] [Created] (CAMEL-16346) camel-main fails to load component properties from Enviroment variables

Gonçalo Pereira created CAMEL-16346:
---------------------------------------

             Summary: camel-main fails to load component properties from Enviroment variables
                 Key: CAMEL-16346
                 URL: https://issues.apache.org/jira/browse/CAMEL-16346
             Project: Camel
          Issue Type: Bug
          Components: camel-main
    Affects Versions: 3.8.0
            Reporter: Gonçalo Pereira


This bug was originally reported in [camel.zulipchat.com|[https://camel.zulipchat.com/#narrow/stream/257302-camel-quarkus/topic/Components.20configuration.20via.20environment.20variables].]

 

When trying to configure camel components using environment variables like {{CAMEL_COMPONENT_AWS2_S3_ACCESSKEY}}, camel fails to configure with the following error:

 
{code:java}
Failed to start application: java.lang.IllegalArgumentException: Error configuring property: camel.component.aws2.s3.overrideendpoint because cannot find component with name aws2. Make sure you have the component on the classpath
        at org.apache.camel.main.BaseMainSupport.lambda$autoConfigurationFromProperties$24(BaseMainSupport.java:1216)
        at org.apache.camel.main.MainHelper.computeProperties(MainHelper.java:266)
        at org.apache.camel.main.BaseMainSupport.autoConfigurationFromProperties(BaseMainSupport.java:1212)
        at org.apache.camel.main.BaseMainSupport.autoconfigure(BaseMainSupport.java:400)
        at org.apache.camel.main.BaseMainSupport.postProcessCamelContext(BaseMainSupport.java:528)
        at org.apache.camel.quarkus.main.CamelMain.initCamelContext(CamelMain.java:108)
        at org.apache.camel.quarkus.main.CamelMain.doInit(CamelMain.java:78)
        at org.apache.camel.support.service.BaseService.init(BaseService.java:83)
        at org.apache.camel.quarkus.main.CamelMain.startEngine(CamelMain.java:129)
        at org.apache.camel.quarkus.main.CamelMainRuntime.start(CamelMainRuntime.java:49)
        at org.apache.camel.quarkus.core.CamelBootstrapRecorder.start(CamelBootstrapRecorder.java:45)
        ...
{code}
 

Also using {{CAMEL_COMPONENT_AWS2-S3_ACCESSKEY}} is not an option as it won't work and uses non-allowed characters for environment variables.

 

In the thread the following suggestions where made by [~cibsen@e-ma.net]:
 * _we could make the ENV only be able to configure 1 level deep, and count the _ then we know if its part of component name or not_
 * _some magic word, like _DASH_ eg so you do AWS2_DASH_SQS_SECRET_TOKEN = 123_
 * _make a known list of component names via camel-catalog, and source code generate it into camel-main so it knows that AWS2_SQS is the component name_

 

The issue was pinpointed to the following line: https://github.com/apache/camel/blob/690d64b19d813ee429857557f28c82f8d755d402/core/camel-main/src/main/java/org/apache/camel/main/MainHelper.java#L59



--
This message was sent by Atlassian Jira
(v8.3.4#803005)