pippo
pippo copied to clipboard
Providing settings programatically
Pippo allows providing the settings via "application.properties" files.
In our application, we already have a custom setting file. Right now we have our own settings and the Pippo settings file.
It would be better if we can provide a custom set of settings to Pippo programmatically. That allows also to load the settings dynamically ( e.g. form DB )
It is easy to configure pippo in code - we use this approach with lightbend config.
pippo.server.settings
.host(config.server.host)
.port(config.server.port)
.keystoreFile(config.server.keystoreFile)
.keystorePassword(config.server.keystorePassword)
.truststoreFile(config.server.truststoreFile)
.truststorePassword(config.server.truststorePassword)
@whyicantusemyemailasusername Thank you for the quick answer. I think this is a nice way to configure, but I was wondering if you can provide a hook into PippoSettings#loadProperties, so one can override that directly.
@whyicantusemyemailasusername Can you add more details related to your approach? I don't understand it.
The code example above is written in kotlin, java code would look like this:
Pippo pippo = new Pippo();
pippo.getServer().getSettings()
.host("localhost")
.port(2020)
.keystoreFile("path/to/file")
.keystorePassword("somepassword");
pippo.start();