Specifying Openfire database properties in Java command line

Hi All,

I would like to know if there’s a way to provide database properties on the java command line when launching Openfire. Database properties are usually specified in conf/openfire.xml, but I have a need to override what’s in there at the time of launching Openfire.

For example, I set the OPENFIRE_OPTS environment variable as shown below, and then started Openfire. However, it does not seem to picking up this property.

export OPENFIRE_OPTS="-Ddatabase.defaultProvider.serverURL=jdbc:mysql://192.168.4.1:33 06/openfire4"

Does anyone know if Openfire supports this mechanism for database properties or they should be always be given in conf/openfire.xml?

Cheers,

Luki

Create your own conference/openfire.XML file before you start the process. Having username and password for the jdbc connection in the ‘ps’ list is not recommended.

I think there is no code in Openfire to read random system properties, so adding -D… has no effect.

Thank for the quick reply.

Yes, we do not plan to inject database credentials through -D options when launching Openfire, but rather just the database server url. This is part of experiment to containerise Openfire. Ideally openfire.xml should accept environment variables in the form of ${ENV_VARIABLE}, but it doesn’t. Therefore, we need find out some other mechanism for injecting configuration to the Openfire container.

Cheers,

Luki

I had the same problem as you did, I agree it would be nice to have a more flexible way of doing it.

But what I did is just to use docker compose and update the entrypoint, mount a config volume and copy it when it starts.