Skip to content

Commit

Permalink
build another test frontend container #4
Browse files Browse the repository at this point in the history
this facebook worker thing is useless:

facebook/create-react-app#936
  • Loading branch information
ruupert committed Feb 8, 2018
1 parent 7290aca commit 75d4e8a
Show file tree
Hide file tree
Showing 2 changed files with 21 additions and 17 deletions.
18 changes: 11 additions & 7 deletions docker-compose.yml
Original file line number Diff line number Diff line change
Expand Up @@ -2,19 +2,23 @@ version: '3'
services:
web:
environment:
BACKEND_LOGIN_URL: "http://svm-61.cs.helsinki.fi/labtool-backend/"
image: labtool/labtool:dev
- BACKEND_LOGIN_URL=https://svm-61.cs.helsinki.fi/labtool-backend/
- PUBLIC_HOST=svm-61.cs.helsinki.fi
- PUBLIC_PATH=/labtool
- PUBLIC_URL=https://svm-61.cs.helsinki.fi/labtool/...
image: labtool/labtool:test
ports:
- "3000:3000"
- "6000:3000"
depends_on:
- backend
- db
backend:
environment:
TOKEN: "changeme"
NODE_ENV: "test"
image: labtool/labtool-backend:dev
- TOKEN=changeme
- NODE_ENV=test
image: labtool/labtool-backend:test
ports:
- "3001:3001"
- "6001:3001"
depends_on:
- db
db:
Expand Down
20 changes: 10 additions & 10 deletions labtool2.0/src/registerServiceWorker.js
Original file line number Diff line number Diff line change
Expand Up @@ -8,21 +8,20 @@
// To learn more about the benefits of this model, read https://goo.gl/KwvDNy.
// This link also includes instructions on opting out of this behavior.

/* TURHAA PASKAA
const isLocalhost = Boolean(
if (!process.env.PUBLIC_URL && process.env.NODE_ENV !== 'development' && 'serviceWorker' in navigator) {
window.location.hostname === 'localhost' ||

// [::1] is the IPv6 localhost address.
window.location.hostname === '[::1]'
// 127.0.0.1/8 is considered localhost for IPv4.
} else {
// [::1] is the IPv6 localhost address.
window.location.hostname === '[::1]' ||
// 127.0.0.1/8 is considered localhost for IPv4.
window.location.hostname.match(
/^127(?:\.(?:25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?)){3}$/
})
)
)

*/
export default function register() {
if (process.env.NODE_ENV === 'production' && 'serviceWorker' in navigator) {
if ((process.env.NODE_ENV === 'production' && 'serviceWorker' in navigator)
|| (process.env.NODE_ENV === 'test' && 'serviceWorker' in navigator)) {
// The URL constructor is available in all browsers that support SW.
const publicUrl = new URL(process.env.PUBLIC_URL, window.location)
if (publicUrl.origin !== window.location.origin) {
Expand All @@ -35,7 +34,8 @@ export default function register() {
window.addEventListener('load', () => {
const swUrl = `${process.env.PUBLIC_URL}/service-worker.js`

if (isLocalhost) {
// if (isLocalhost) { // KURA FACEBOOK COM
if (process.env.NODE_ENV === 'development') {
// This is running on localhost. Lets check if a service worker still exists or not.
checkValidServiceWorker(swUrl)

Expand Down

0 comments on commit 75d4e8a

Please sign in to comment.