Federico Mariani created CAMEL-20872:
----------------------------------------

             Summary: Create PropertyFunction that loads properties form a 
database
                 Key: CAMEL-20872
                 URL: https://issues.apache.org/jira/browse/CAMEL-20872
             Project: Camel
          Issue Type: New Feature
          Components: camel-jdbc, camel-sql
            Reporter: Federico Mariani


It is common to use a database like a vault, where users store key/value 
secrets. It would be nice to have a PropertyFunction that can be used to 
retrieve that information, in particular, the user experience should be similar 
to the hashicorp-vault one. Given a table with the following structure

 
{code:java}
CREATE TABLE mySecrets (myKey VARCHAR(255), myValue VARCHAR(255));
{code}
the PropertyFunction can be configured via system properties like
{code:java}
camel.vault.sql.url=jdbc:<database>://<host>:<port>/<databaseName>
camel.vault.sql.username=myUser
camel.vault.sql.password=myPassword
camel.vault.sql.driverClassName=com.mysql.jdbc.Driver{code}
and the properties can be retrieved via
{code:java}
{{sql:<databaseName:?><returnColumn><table><keyColumn><key>}}
{code}
for example
{code:java}
{{sql:myValue/mySecrets/myKey/myUsername}}
{code}
Given that _<returnColumn><table><keyColumn>_ should be constant, we may add 
those to system properties ala
{code:java}
camel.vault.sql.valueColumn=<returnColumn>
camel.vault.sql.table=<table>
camel.vault.sql.keyColumn=<keyColumn>{code}
and the expression can be
{code:java}
{{sql:myUsername}}
{code}

This is just a first an hypothetical implementation, I am open to discussions.

 



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

Reply via email to