Updating Configuration Settings at Runtime

You can configure a file where you keep configuration properties that you may want to update and apply to SAP Commerce at runtime. Applying new configuration settings without restarting may be useful when you run SAP Commerce in a cloud environment.

To update your Platform configuration settings at runtime, use the RuntimeConfigLoader interface and its implementation called FileBasedConfigLoader. This implementation watches your configured properties file and loads your updated configuration whenever you modify this file.

The Platform logic checks your properties file for changes at regular intervals. After you change the file, the logic loads it and sets all the updated properties in the SAP Commerce configuration.

Setting Up FileBasedConfigLoader

You must configure FileBasedConfigLoader to watch your properties file.

First, use the runtime.config.file.path property to point to your file, for example:

runtime.config.file.path=/etc/hybris/runtime.properties

Then start SAP Commerce. Now each configured tenant starts a separate thread that will use FileBasedConfigLoader to watch the configured file.

To configure how often you want to check for configuration changes, use the runtime.config.refresh.time.seconds property. The default value is 30 seconds.

Reading Properties From Different Sources

SAP Commerce provides only one implementation of the RuntimeConfigLoader interface that operates on a properties file. You can implement your own strategy and configure it as a default strategy by using the runtime.config.loader.class property:

runtime.config.loader.class=org.foo.bar.YourImplementation

Your implementation must build the standard java.util.Properties object whenever the underlying configuration source has changed. Then the configuration will be set for you automatically.