Uploaded image for project: 'Camel'
  1. Camel
  2. CAMEL-16345

camel-main fails to load component properties from Enviroment variables

    XMLWordPrintableJSON

Details

    • Bug
    • Status: Resolved
    • Minor
    • Resolution: Fixed
    • 3.8.0
    • 3.9.0
    • camel-main
    • None
    • Unknown

    Description

      This bug was originally reported in camel.zulipchat.com

       

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

       

      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)
              ...
      

       

      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

      Attachments

        Issue Links

          Activity

            People

              davsclaus Claus Ibsen
              goncalonsp Gonçalo Pereira
              Votes:
              0 Vote for this issue
              Watchers:
              1 Start watching this issue

              Dates

                Created:
                Updated:
                Resolved: