Merge "Disable service workers by default"
This commit is contained in:
commit
d010bec30a
|
@ -17,8 +17,8 @@ FROM opendevorg/python-builder as builder
|
||||||
|
|
||||||
# Optional location of Zuul API endpoint.
|
# Optional location of Zuul API endpoint.
|
||||||
ARG REACT_APP_ZUUL_API
|
ARG REACT_APP_ZUUL_API
|
||||||
# Optional flag to disable React Service Worker. (set to true to disable)
|
# Optional flag to enable React Service Worker. (set to true to enable)
|
||||||
ARG REACT_APP_DISABLE_SERVICE_WORKER
|
ARG REACT_APP_ENABLE_SERVICE_WORKER
|
||||||
|
|
||||||
COPY . /tmp/src
|
COPY . /tmp/src
|
||||||
RUN /tmp/src/tools/install-js-tools.sh
|
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/
|
.. _Patternfly: https://www.patternfly.org/
|
||||||
.. _create-react-app: https://github.com/facebook/create-react-app/blob/master/packages/react-scripts/template/README.md
|
.. _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
|
By default, zuul-web provides a Progressive Web Application but does
|
||||||
advanced caching. In order to do that set the environment variable
|
not run a Service Worker. For deployers who would like to enable one,
|
||||||
``REACT_APP_DISABLE_SERVICE_WORKER=true`` during installation.
|
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 () {
|
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')
|
console.log('Disabled service worker')
|
||||||
|
unregister()
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue