Inject a base url for my remote api that is called by a number of scripts in the jsreport online service

  • Hello,

    I am able to set a root url via the dotenv package for my on premise reporting service, but I couldn't find in the documentation how do accomplish the same thing using the online reporting service.

    Here's an example from my on premise server:

    const process = require('process');
    var getRequest = require('request');
    function beforeRender(req, res, done) {
        var baseUrl = process.env.JSREPORT_BASE_URL;
        var url = baseUrl + 'balance_due_listing/';
        console.log(url +;
        getRequest(url +, function(err, resp, body) {
            if (err) {
                return done(err);
   = JSON.parse(body);

    I'm not set on a specific method of doing this, I would just like to be able to update the baseUrl depending on my environment.


  • I see you are looking for a centralized place where to put your configurations.
    You can use assets for this.

    For example approach like here

  • Thanks, the key here for me was creating the script as an asset (config.js), not a Script.

Log in to reply

Looks like your connection to jsreport forum was lost, please wait while we try to reconnect.