pippo icon indicating copy to clipboard operation
pippo copied to clipboard

Providing settings programatically

Open kiru opened this issue 5 years ago • 4 comments

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 )

kiru avatar May 04 '19 10:05 kiru

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.

kiru avatar May 04 '19 12:05 kiru

@whyicantusemyemailasusername Can you add more details related to your approach? I don't understand it.

decebals avatar Jan 15 '20 14:01 decebals

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();