Hi can I get some help with setting environment specific configuration. I have two files for datasource
- server/datasources.json
- server/datasources.test.json
I use the script "SET NODE_ENV=test && mocha test/**/*.test.js" on WIndows to run my test cases and set the node environment to test. Loopback does not load server/datasource.test.json instead the datasource from server/datasource.json is loaded.
I have confirmend the environment using process.env.NODE_ENV which logs "test
I have tried to change server/datasource.json to server/datasource.local.json, But then I get an error WARNING: Main config file "datasources.json" is missing.
I dont understand what I am doing wrong.Am I supposed to create all the config files for the test environment like *.test.json. Or is there a different config file where I have to define envrionment specific files.
Please check this repo https://github.com/dhruv004/sample-loopback-example
From the code If you run npm run test It loads data from local.json which is the data source for development environment.It should load data from test.json(datasource for test environment)
server/datasource.test.jsonorserver/datasources.test.json? - Ivan Schwarzserver/datasources.jsonadd a new key"testDb": { "name": "db", "connector": "memory", "file":"test.json" }and then change datasource of the model inmodel-config.json- dhrDatt