[ 
https://issues.apache.org/jira/browse/CAMEL-24629?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=18113401#comment-18113401
 ] 

Cameron Fitzwater commented on CAMEL-24629:
-------------------------------------------

Actually, I retract part of my statement. 

{*}The base code provided in your last response was not sufficient to catch the 
issu{*}e, and I do now *still believe a bug exists* (but still stand by a 
possibly separate question about whether application.properties could support 
.env syntax in future feature request).

When using:
{code:java}
export HOST=jsonplaceholder.typicode.com{code}
{code:java}
camel run test.yaml application.properties --runtime quarkus{code}

... and having:
 
{code:java}
- route:
    id: getDataRoute
    from:
      uri: "direct:getData"
      steps:
        - setHeader:
            name: apikey
            constant: "{{my.apikey}}"
        - removeHeaders:
            pattern: "*"
        - to:
            uri: "https://{{my.host}}/posts";
            parameters:
                lean: 1
                bridgeEndpoint: true
                throwExceptionOnFailure: true
        - toD:
            uri: "https://{{my.host}}/posts/1";
            parameters:
                lean: 1
                bridgeEndpoint: true
                throwExceptionOnFailure: true{code}
 

Error:
{code:java}
Caused by: org.apache.camel.language.simple.types.SimpleParserException: 
Unknown function: HOST{code}

I would not have expected this – it should be aware of the value (if you 
commend out toD block, and use same command, it works and is aware of the 
value, as expected).



 

 

> toD not taking into account substituted properties with env variables
> ---------------------------------------------------------------------
>
>                 Key: CAMEL-24629
>                 URL: https://issues.apache.org/jira/browse/CAMEL-24629
>             Project: Camel
>          Issue Type: Bug
>          Components: camel-core
>    Affects Versions: 4.22.0
>            Reporter: Cameron Fitzwater
>            Assignee: Torsten Mielke
>            Priority: Minor
>         Attachments: camel-24629.zip
>
>
> I have a .env file that has:
> MY_HOST=abc
>  
> My application.properties file has:
> my.host=${MY_HOST}
>  
> When using {*}toD{*}:
>  - toD:
>             uri: 
> "https://{{{{{}my.host{}}}}}.domain.com/${exchangeProperty.location}";
>             parameters:
>                 lean: 1
>                 bridgeEndpoint: true
>                 throwExceptionOnFailure: false
> This is failing when using *quarkus* runtime. I've sourced my .env before 
> running camel run/export, still fails.
>  
> It does NOT fail when using it in *to:* component.
>  
> I use this convention to wire the application so that it can more easily be 
> consumable by K8s to set the environment variables.
>  
>  
> Error:
> {code:java}
> org.apache.camel.FailedToCreateRouteException: Failed to create route: 
> get-location at: >>> 
> DynamicTo[toD[https://{{my.host}}.domain.com/${exchangeProperty.location}?bridgeEndpoint=true&lean=1&throwExceptionOnFailure=false]]
>  <<< in route: 
> Route(get-location)[From[rest:get:/:/locations/{id}?routeId=... because: 
> Unknown function: MY_HOST at location 8
> https://${MY_HOST}.domain.com/${exchangeProperty.location}?bridgeEndpoint=true&lean=1&throwExceptionOnFailure=false
>         *{code}



--
This message was sent by Atlassian Jira
(v8.20.10#820010)

Reply via email to