Hi, May be we can try loading this property file in the app.js (Init script as we discuss earlier). But if that is not working the best way is to put a timeout. Because we have no any other way to get these properties in the init script.
Let's ask manu is there any better way to do this using jaggery ?? ... (If we can read the property file without too much file processing) adding manu .... Regards, On Fri, Nov 6, 2015 at 2:28 PM, Thanuja Uruththirakodeeswaran < [email protected]> wrote: > Hi All, > > In the current implementation, we are reading dasStatsPublisherEnabled and > meteringDashboardUrl in login.jag file [1] and adding them to session. But > since these values are common to all users, we should read these values at > web application startup and add them to application object. So I tried to > do that in web application initScripts js file (app.js) [2] as follows: > > var carbon = require('carbon'), > process = require('process'), > server = new carbon.server.Server(), > conf = carbon.server.loadConfig('thrift-client-config.xml'), > dasConfig = conf. *::['config']. *::['das'], > dasStatsPublisherEnabled = false; > > > for (var i = 0; i < dasConfig.node.length(); i++) { > dasStatsPublisherEnabled = dasConfig.node[i].statsPublisherEnabled.text(); > if (dasStatsPublisherEnabled == true) { > break; > } > } > application.put("dasStatsPublisherEnabled",dasStatsPublisherEnabled); > > setTimeout(function(){ > application.put("meteringDashboardUrl", > process.getProperty("das.metering.dashboard.url")) > },30000); > > We can read thirift-client-config.xml file and adding > dasStataPublisherEnabled variable to application without any problems. But > we have problem in reading metering dashboard url which is in > cartridge-config.properties at web app initialization. > > Here since* webapp is started before stratos-manager component gets > activated (which reads cartridge-config.properties file and set values in > that file as system properties [3])*, we need to have a timeout to wait > for stratos-manager component to be activated before reading > meteringDashboardUrl using jaggery process module. > > Is there a better way to do this without having a timeout? Please give > your suggestions. > > [1]. > https://github.com/wso2/product-private-paas/blob/master/components/org.wso2.ppaas.manager.console/console/controllers/login/login.jag > [2]. > https://github.com/wso2/product-private-paas/blob/master/components/org.wso2.ppaas.manager.console/console/app.js > [3]. > https://github.com/apache/stratos/blob/stratos-4.1.x/components/org.apache.stratos.manager/src/main/java/org/apache/stratos/manager/internal/StratosManagerServiceComponent.java#L117 > > Thanks. > -- > Thanuja Uruththirakodeeswaran > Software Engineer > WSO2 Inc.;http://wso2.com > lean.enterprise.middleware > > mobile: +94 774363167 > > _______________________________________________ > Dev mailing list > [email protected] > http://wso2.org/cgi-bin/mailman/listinfo/dev > > -- Nipuna Marcus *Software Engineer* WSO2 Inc. http://wso2.com/ - "lean . enterprise . middleware" Mobile : +94 (0) 713 667906 [email protected]
_______________________________________________ Dev mailing list [email protected] http://wso2.org/cgi-bin/mailman/listinfo/dev
