Is it possible to use multiple config files?
-
Is it possible to use multiple config files ?
e.g.
- jsreport.config.json -> default configuration
And then one of the following on top of the default config
- dev.config.json
- tst.config.json
- stg.config.json
- prod.config.json
It seems that I can only provide one configFile by argument, and when using the jsreport.config.json file is not used.
-
You would like to merge multiple config files?
No, this isn't possible.However, this is very easy to code on your side.
You can updateserver.js
with something like this:const fs = require('fs') const jsreport = require('jsreport')({ ...JSON.parse(fs.readFileSync('myconfig1.json').toString()), ...JSON.parse(fs.readFileSync('myconfig2.json').toString()) }) if (process.env.JSREPORT_CLI) { module.exports = jsreport } else { jsreport.init().then(async () => { }).catch((e) => { console.trace(e) process.exit(1) }) }