Isai Ulate Sancho Isai Ulate Sancho - 1 month ago 6
Groovy Question

Craftercms: How to access Crafter engine properties in groovy controllers?

Is it possible to access the crafter engine properties (defined in server-config.properties) from groovy? As an example: access the property “crafter.engine.site.default.staticAssets.path” ...

So far I have tried accessing the "crafter.properties" bean using the applicationContext object, but I haven't been able to access the configured properties from that bean.

Answer

Crafter Engine provides a Groovy variable called globalProperties that you can use to access properties defined in server-config.properties:

globalProperties.getProperty("crafter.engine.site.default.staticAssets.path")
Comments