JBoss EAP 6.2 | How to configure datasource username password to be dynamic

1k views Asked by At

Requirement:

We have JBoss EAP 6.2. In standalone.xml, we have datasource configured. Our requirement is that we do not want username and password in standalone.xml.

Username and password are received from some external system call.

So, is there any custom way to provide username and password to JBoss from this our external system?

1

There are 1 answers

0
DaveB On

You can provide dynamic values in standalone.xml using server startup parameters eg.

<security>
    <user-name>${datasource.username}</user-name>
    <password>${datasource.password}</password>
</security>

values can be set in standalone.conf (eg. -Ddatasource.username=$SOME_VAR) which could come from environment variables set in a bash script from your external call

Or you can use the CLI to add a datasource manually, use the following CLI command to get a list of commands:

data-source add --help  

note however this wont bypass standalone.xml as the username/password will still be added to the xml file