Read system properties from JS

Enonic version: 6.13.1
OS: Centos 6


I have a property called in
How can I get this property within JS?

Thanks for any help.

I suppose you mean in the XP_HOME/config/system.propeties file.
Is there a reason to set it in that file?

It would be better to set the property in the config file for your application.

You can create a file with the name of you application key, and extension '.cfg'

Example XP_HOME/config/com.enonic.myapp.cfg

Then in your Javascript controller code you can just get the value like this:

var dbAdminUrl = app.config['db.admin.url'];

See documentation here:

1 Like


The reason I set it in the XP_HOME/config/system.propeties file is that this property is the same for all applications in the installation,

There is no javascript api to access the file. It was not meant to be used for shared application properties. It’s for internal XP configuration.

You could try to use this library to access the file system:
Or make a new library in Java.

1 Like