Reputation: 999
I'm using liquibase via command line, i am wondering how to setup liquibase.properties file to read environment variables?
something like:
***liquibase.properties***
driver=org.postgresql.Driver
classpath=lib/postgresql-42.2.5.jar
url=${DATASOURCE_URL}
username=${DATASOURCE_USERNAME}
password=${DATASOURCE_PASSWORD}
changeLogFile=changelogs/master.yaml
Upvotes: 6
Views: 15254
Reputation: 29
For the time being there is no way to use environment variables in the liquibase.properties file. This have to be implemented in the source code since Java by default won't recognize them. See https://stackoverflow.com/a/2263944/5418766 for details.
I had a similar problem trying to read the database credentials from a Bitwarden vault. I've ended up using the variables in the batch file (I'm using Windows) calling Liquibase and that worked for me.
Upvotes: 2