I am trying to get some parameters from environment varibles into liquibase_data.properties which read into my changelog file but not having much success.
The following is my liquibase_data.properties file:
db1.name=${DB1_HOSTNAME}
db2.name=${DB2_HOSTNAME}
Changelog File:
<property name="db.properties" file="liquibase_data.properties"/>
<changeSet author="dmohanpuria (generated)" id="1710307015865-2">
<insert tableName="datasource_detail">
<column name="dade_id" valueNumeric="1"/>
<column name="dade_client_id" valueNumeric="1"/>
<column name="**dade_source_url**" value=**"${db1.name}"**/>
<column name="dade_recovery_url"/>
<column name="dade_driver_class_name" value="com.microsoft.sqlserver.jdbc.SQLServerDriver"/>
<column name="dade_dialect" value="MSSQL"/>
</insert>
</changeSet>
The problem is dade_source_url is always coming back as the literal value "${DB1_HOSTNAME}" and not the value getting passed in environment variables. The reason I need this is because this database source url changes from environment to environment.
Any help would be appreciated, thanks.
Seems similar to custom properties in liquibase.properties file . You could also use DB1_HOSTNAME directly in your changelog as:
<column name="dade_source_url" value="${DB1_HOSTNAME }"/>
You don't need to pass it to a properties file, you just use it directly.