I'm deploying VueJS project. There is a file that contain API URLs where I use process.env. If API_URL is defined in production only so I can use localhost on my development server and API_URL in the production.
const apiRoot = process.env.API_URL || 'http://127.0.0.1:8000'
export default {
root: apiRoot,
auth: {
jwt: {
create: urljoin(apiRoot, "auth/jwt/login/"),
refresh: urljoin(apiRoot, "auth/jwt/refresh/"),
},
loginPage: "/login",
me: urljoin(apiRoot,"users/me/")
}
}
On the server, I've added EXPORT API_URL='my.api.url' and then I ran npm run build. Then I realized it is still using 127.0.0.1:8000 so I also added the ENV VAR to /etc/environment file.
Again, no success. I've rebooted the server.
In cmd line I can do this:
echo $API_URL
'my.api.url'
How to make it work? Or how to debug this issue?