I have a React front-end that uses an Express back-end hosted in separate spaces on the same server. Both elements use Plesk’s Node.js application containers. Both elements have a development and production version, and the development versions are being updated concurrently.
I would like the development version of the front-end to use a development version of the back-end, based on the ‘Application Mode’ selection in the Plesk interface.
Plesk ‘Application Mode’
I have an AppInit file that contains the front-end config:
const configValues = {
apiUrl: (!process.env.NODE_ENV || process.env.NODE_ENV === 'development') ? "https://myDevUrl/api" : "https://myProdUrl/api",
...
}
Changing the Application Mode has no effect; the environmental variable process.env.NODE_ENV
value is production
, even if I rebuild the app and restart the container.