OHDSI Home | Forums | Wiki | Github

WebAPI properties

Do you think we can switch WebAPI to use Maven properties for the current ones stored in the web.xml?

I’ll be working on cohort apis and that way, we won’t have to change source code. We’ll just have to override the properties in our local Maven settings.xml file. We can create profiles too.

I forked WebAPI, I can make my proposed changes there.

I’m not familiar with Maven properties but willing to consider it of course. Let me know when I can check out your fork to see how they work.

I committed a basic version here (although, we may be nixing this repo, and just moving to regenstrief instead of regenstrief-dsi).

However, a better way to manage database connections is through Spring’s dependency injection mechanism, and longer term, that is probably the best way to go.

Ok, so it looks like this ends up using property files instead of the web.xml. Is that correct? How does someone edit the properties file after installation? Is it similar to web.xml in that it will be extracted by the web server that hosts the war?

So the properties are in the pom file, and they automatically get updated at build time. The benefit to this approach is you can use an external properties file, or a profile in your settings.xml, so that you keep all of the secure passwords out of the code repo, and you don’t have to worry about accidentally committing the password because it’s stored on your local file system. If you have to change the pom file, no worries when you commit it because the passwords aren’t stored in there.

Understood. So for the administrator that is install this software by deploying it to a web server, how do they configure the properties?

Then you could build the war using those properties via filters, or use an external properties file. Or the best way is to build the war with the profile. But for Heracles, we’re going to be building a way for users to configure at setup time. Hopefully, that model can be applied for other projects.

t