# Different paramaters in one liquibase .properties file possible?

**URL:** <https://forum.liquibase.org/t/different-paramaters-in-one-liquibase-properties-file-possible/4742>\
**Category:** General Discussion\
**Created:** [October 21, 2020, 8:15pm UTC](https://forum.liquibase.org/t/different-paramaters-in-one-liquibase-properties-file-possible/4742 "2020-10-21T20:15:15Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![tdgfbi](https://avatars.discourse-cdn.com/v4/letter/t/919ad9/32.png) [@tdgfbi](https://forum.liquibase.org/u/tdgfbi)\
**Post date:** [October 21, 2020, 8:15pm UTC](https://forum.liquibase.org/t/different-paramaters-in-one-liquibase-properties-file-possible/4742/1 "2020-10-21T20:15:15Z")

</div>

Hey all I am wondering if its possible to place different .properties inside just one .properties file so that I do not have to make a seprate .praperties file for each of my database?

[This site](https://mohitgoyal.co/2019/03/20/selectively-apply-changes-to-database-environments-using-liquibase/) here is doing what I would like to do but it doesnt explain how to go about sending those contexts to the .properties file. And it also seems to be using seprate .properties files. As in, it doesnt show me how it should look inside the .properties file. Another good [example](https://stackoverflow.com/questions/42368969/liquibase-passing-parameter-from-commandline-or-properties-to-changeset-xml) is here but again, it doesnt do it in the .properties file.

Let’s say I have the following inside my .properties file:

```
#liquibase.properties file content
url: jdbc:oracle:thin:@xxxxxxxx.str3.xxxxx.xxxxx:1511/xxxxxx.xxxxx.xxxxx.xxxxx
username: SEPRATE_1PEGA_BASEDA
password: XXXXXXXXXXXXX
referenceUrl: jdbc:oracle:thin:@xxxxxxxx.str2.xxxxx.xxxxx:1511/xxxxxx.xxxxx.xxxxx.xxxxx
referenceUsername: SEPRATE_1PEGA_BASEDB
referencePassword: YYYYYYYYYYYYYY
changeLogFile: diff_change.txt
diffTypes: tables, views, columns, indexes, foreignkeys, primarykeys, uniqueconstraints

```

And I am wanting to send a paramater to replace the “str2” and “SEPRATE\_1PEGA\_BASEDB” varibles currently hard-coded inside the .properties file. So I write the .properties file like so:

```
#liquibase.properties file content
url: jdbc:oracle:thin:@xxxxxxxx.str3.xxxxx.xxxxx:1511/xxxxxx.xxxxx.xxxxx.xxxxx
username: SEPRATE_1PEGA_BASEDA
password: XXXXXXXXXXXXX
referenceUrl: jdbc:oracle:thin:@xxxxxxxx.${liquibase.properties.str}.xxxxx.xxxxx:1511/xxxxxx.xxxxx.xxxxx.xxxxx
referenceUsername: ${liquibase.properties.un}
referencePassword: YYYYYYYYYYYYYY
changeLogFile: diff_change.txt
diffTypes: tables, views, columns, indexes, foreignkeys, primarykeys, uniqueconstraints

```

So would the CLI for this look like:

`liquibase --str=str5 --un=BobBarker diff`

My liquibase version is `Liquibase-3.6.2`.

---

<div class="post-metadata">

**Author:** ![tdgfbi](https://avatars.discourse-cdn.com/v4/letter/t/919ad9/32.png) [@tdgfbi](https://forum.liquibase.org/u/tdgfbi)\
**Post date:** [October 22, 2020, 2:37pm UTC](https://forum.liquibase.org/t/different-paramaters-in-one-liquibase-properties-file-possible/4742/2 "2020-10-22T14:37:53Z")

</div>

just bumping in hopes someone knows how to do this. 😀

---

<div class="post-metadata">

**Author:** ![mariochampion](https://avatars.discourse-cdn.com/v4/letter/m/bbe5ce/32.png) [@mariochampion](https://forum.liquibase.org/u/mariochampion)\
**Post date:** [October 28, 2020, 1:42pm UTC](https://forum.liquibase.org/t/different-paramaters-in-one-liquibase-properties-file-possible/4742/3 "2020-10-28T13:42:20Z")

</div>

hey tdgfbi,

I think this thought: " [This site](https://mohitgoyal.co/2019/03/20/selectively-apply-changes-to-database-environments-using-liquibase/) here is doing what I would like to do but it doesnt explain how to go about sending those contexts to the .properties file."  
is super close to your answer.

further down in that same page, the author mentions using TWO properties files, suffixed based on context, and passing the right one in via the command line.

> When running liquibase command, we need to tell the relevant properties file to use:
> 
> liquibase --defaultsFile=liquibase\_development.properties --contexts=development update  
> liquibase --defaultsFile=liquibase\_production.properties --contexts=production update

you could certainly automate this with a variable equal to context and using that in the CLI, for example say you were calling it from a bash script:

> CONTEXTVAR=“production”  
> liquibase --defaultsFile=liquibase\_$CONTEXTVAR.properties --contexts=$CONTEXTVAR update

but obviously you could tweak that for whatever scripting language you need.

you could also do the same drawing the var from ENVironment variables, too, if you are building liquibase calls to the cli from an external source like bash or python, etc.

hope this helps,  
mario
