Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Providing settings programatically #513

Open
kiru opened this issue May 4, 2019 · 4 comments
Open

Providing settings programatically #513

kiru opened this issue May 4, 2019 · 4 comments

Comments

@kiru
Copy link
Contributor

kiru commented May 4, 2019

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 )

@whyicantusemyemailasusername
Copy link
Contributor

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)

@kiru
Copy link
Contributor Author

kiru commented May 4, 2019

@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.

@decebals
Copy link
Member

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

@whyicantusemyemailasusername
Copy link
Contributor

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

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants