You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@camel.apache.org by GitBox <gi...@apache.org> on 2020/09/25 11:41:07 UTC
[GitHub] [camel-k] lburgazzoli edited a comment on issue #1715: Environment Variables from Secrets
lburgazzoli edited a comment on issue #1715:
URL: https://github.com/apache/camel-k/issues/1715#issuecomment-698881702
if your put the credential in a secret, then you can use
kamel run --secret your-secret
the secret is then mounted to the pod and its values are made available to the integration thus you can do something like:
```java
@BindToRegistry("dataSource")
public BasicDataSource datasoure(
@PropertyInject("db.usr") String usr,
@PropertyInject("db.pwd") String pwd) {
BasicDataSource dataSource = new BasicDataSource();
dataSource.setDriverClassName("org.postgresql.Driver");
dataSource.setUrl("jdbc:postgresql://postgres:5432/my-db");
dataSource.setUsername(usr); // <-- from secret
dataSource.setPassword(pwd); // <-- from secret
return dataSource;
}
```
----------------------------------------------------------------
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.
For queries about this service, please contact Infrastructure at:
users@infra.apache.org