I am in the process of putting into production a web application (back: Django rest framework, front: vue-cli3) But my deployment environment is very specific. I have an embedded card on which a Linux is deployed. This card runs in a local area network and its IP address is managed via DHCP from the router. On this card, there is the Django server and an Nginx to manage the build of Vuejs app.
My problem is to modify the base URL Axios (it makes the HTTP request between vue.js and my server)with the IP address of the card so that the vue-js application on the client can communicate with the back which is on the card.
So do you know a way to change the base_url of Axios after the build of vue-js?
Thanks in advance! And sorry for my pitiful English, I'm french
- I test to put in another file (conf.json) my address IP which I can change with python file if the DHCP send me a new IP address but it's don't work.
- I test with the hostname of the card but in windows computer, the zeroconf can work without install software like Avahi in Linux
This my Axios config, I would like to change process.env.API_URL after the build because I don't know the IP address of the server.
export default() => {
return axios.create({
baseURL: process.env.API_URL,
withCredentials: false,
headers: {
'Accept': 'application/json',
'Content-Type': 'application/json',
}
})
}