I want to enable/disable maintenance page for my react application in Azure without deployment.
Approach followed:
added one variable in .env file (REACT_APP_IS_MAINTENANCE_PAGE_ENABLED= 0) and same key in App settings of Environment variables in azure App, but unable to read value from environment variable from Azure App service.
How can we achieve this?
please suggest any other approaches if this won’t work.
2
Answers
Achieved using Deployment Slots. Steps followed:
I have manually added a toggle button between the maintenance page and regular content without fetching from an external source. It worked locally and in the Azure web app.
Code :
src/components/App.js :
src/components/maintenancePage.js :
Output :
I was able to build and run the react app successfully using below commands,
I got the below output with the port 3000. Then, I clicked on Toggle Maintenance Page(Disabled) to get the maintenance page as below,
I could enable and disable the maintenance page using the below toggle button as below,
Then, I deployed my build folder to Azure web app as below,
I could enable and disable the maintenance page using the toggle button** in the Azure web app below.