How to manage local environment properties How to manage local environment properties

Here is an excellent question from Karl Haris. He asks about managing local environment properties.

It's actually dead simple once you know it, but I am not sure people are really aware of this. The only thing you have to do is add your new property to the nuxeo.conf file. For the more curious, know that these properties end up in nxserver/config/ when your server starts.

How to retrieve properties in Nuxeo Studio

If you use scripting in Nuxeo Studio, this feature can come in handy. Here's how you do it in MVEL:


As stated in the documentation:

This is very useful when you want to use parameters in your operations that are dynamic and that can change later depending on the running server environment. For example, let's say you want to make an operation that creates a document and initializes its description from a Nuxeo property named automation.document.description.

How to retrieve properties in Java

If you are familiar with developing with Nuxeo, you might know the Framework class. That's the one used to retrieve those properties. Here's how you do it in Java:

String nuxeoUrlProperty = Framework.getProperty("nuxeo.url");

This is useful for information relative to your server instance. For instance, its URL, the database settings, a path on the server's filesystem pointing to an SSL key or maybe to a folder from which you could import a set of files.

That's it for today, see you next Monday!