Disable service workers by default
The Service Workers seem to be consistently causing issues for people that are strange, meaning many of our deployers are disabling them. Since they aren't super necessary for the Zuul use case, change the default behavior to be to disable them instead of enable them. Change-Id: Iea8348a3b007badaae74fc1837b55bb0b076ac65
This commit is contained in:
parent
73feab3b13
commit
b4f6ef7b70
|
@ -17,8 +17,8 @@ FROM opendevorg/python-builder as builder
|
|||
|
||||
# Optional location of Zuul API endpoint.
|
||||
ARG REACT_APP_ZUUL_API
|
||||
# Optional flag to disable React Service Worker. (set to true to disable)
|
||||
ARG REACT_APP_DISABLE_SERVICE_WORKER
|
||||
# Optional flag to enable React Service Worker. (set to true to enable)
|
||||
ARG REACT_APP_ENABLE_SERVICE_WORKER
|
||||
|
||||
COPY . /tmp/src
|
||||
RUN /tmp/src/tools/install-js-tools.sh
|
||||
|
|
|
@ -193,6 +193,7 @@ As long as `yarn`_ is installed, the installation of zuul will run
|
|||
.. _Patternfly: https://www.patternfly.org/
|
||||
.. _create-react-app: https://github.com/facebook/create-react-app/blob/master/packages/react-scripts/template/README.md
|
||||
|
||||
In some cases there is the need to disable the service worker which does
|
||||
advanced caching. In order to do that set the environment variable
|
||||
``REACT_APP_DISABLE_SERVICE_WORKER=true`` during installation.
|
||||
By default, zuul-web provides a Progressive Web Application but does
|
||||
not run a Service Worker. For deployers who would like to enable one,
|
||||
set the environment variable
|
||||
``REACT_APP_ENABLE_SERVICE_WORKER=true`` during installation.
|
||||
|
|
|
@ -0,0 +1,6 @@
|
|||
---
|
||||
upgrade:
|
||||
- |
|
||||
Service Workers are now disabled by default in the Javascript
|
||||
dashboard. Deployers who wish to enable them need to set
|
||||
``REACT_APP_ENABLE_SERVICE_WORKER``
|
|
@ -21,8 +21,9 @@ const isLocalhost = Boolean(
|
|||
)
|
||||
|
||||
export default function register () {
|
||||
if (process.env.REACT_APP_DISABLE_SERVICE_WORKER === 'true') {
|
||||
if (process.env.REACT_APP_ENABLE_SERVICE_WORKER !== 'true') {
|
||||
console.log('Disabled service worker')
|
||||
unregister()
|
||||
return
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in New Issue