1
votes

How can I pass MP config property file to OL on the command line? The wlp/bin/server.bat does not allow to pass even Java system properties...

I have looked at the OL MP config example and it assumes that the configuration is in the user user.home system property - not very useful.

I read the various WS Liberty docs and they require me to configure in XML the location where the property file is - also not very flexible. Other options involve using environment variables - not what I want.

What I want is something as flexible as:

bin/server.bat -Dmy.conig=c:/temp/myconfig.properties

This example above is similar to how Spring/SpringBoot does it. Thanks!

1
You can create multiple jvm.options files in the following locations: ${wlp.install.dir}/usr/shared/jvm.options ${server.config.dir}/configDropins/defaults/jvm.options ${server.config.dir}/jvm.options ${server.config.dir}/configDropins/overrides/jvm.options - covener
or native environment variable JVM_ARGS - covener
So, there is no way to just pass some options from the command line, which is the most flexible option? - Hristo Stoyanov

1 Answers

2
votes

There are a few solutions for your use case:

  1. Use your properties file as the default config in the app by placing your file inside the app under META-INF\microprofile-config.properties for jar or WEB-INF\classes\META-INF\microprofile-config.properties

  2. Use your config as default jvm properties by using the instruction provided by covener. You can put the content of myconfig.properties into jvm.options or just rename your file to be jvm.options but place under one of the locations mentioned by covener.

  3. Use your properties file as a custom config source. You can directly implement MicroProfile config api ConfigSource to parse this property file and provide the name value pairs for your app.

You can find more info about MicroProfile config from the open liberty guide (https://openliberty.io/guides/microprofile-config-intro.html)