I have a project (or 2 actually) where a frontend server is talking/requesting data from a backend server (written in Python). Now when I build and distribute the dist I also define the ip-address to the backend. This is not dynamic and i have to change ip and build again for every distribution (new IP-address). My wish is to be able to set the ip-address to backend-server, if default coded address is wrong (usually) via a data.json file that is looking like this
[{"FRONTEND_IP": "192.168.1.35" },{"BACKEND_IP": "192.168.1.123" }]
There is a ton of samples on how to read .json files from within code base and I have discovered that i can import file into a variable, like this
import posts from '../../data.json'
And use it as the array of json data it is. My problem is that when I build with
npm run build
it (the data.json file) gets included into the dist package hence I can't change the IP.
Have you got any tips on how to solve my problem with an external config file outside the dist compilation
/a