I’m trying to get some configuration settings on javascript controller for jobs. I’ve created a “ConfigurationHelper” class to get it, but it’s only accessible via a url (which doesn’t work for jobs, since I can’t do a “portal.pageUrl”. I want to know if there’s a way of getting config settings on non-context controllers, so I could use a function like: ConfigurationHelper.getConfig(“configKey”);
Here’s the code I’ve reached.
http://pastebin.com/5a2jPKSH
@navyhod in this case, it’s not Portal functions or siteConfig… I’m talking about installation settings, like the vhosts file. I want to read the key-value pair and get these configs, since they won’t be visible for the users or they will not be site settings (declared on site.xml).
Application configuration is already implemented in XP. If you want to have a configuration file for your app, then create a <app-name>.cfg
file in $XP_HOME/config
directory. All config variables are then accessable in JavaScript as app.config
.
See http://xp.readthedocs.io/en/stable/developer/ssjs/global-objects.html
2 Likes
Thanks!!! That helped me a lot!