diff --git a/src/mirage/index.ts b/src/mirage/index.ts index 61f75db4f..abea4bf79 100644 --- a/src/mirage/index.ts +++ b/src/mirage/index.ts @@ -20,11 +20,12 @@ import { Server as WSServer, Client } from 'mock-socket'; import factories from './factories'; import models from './models'; import { Resource } from './typings'; -import { sizeUnits } from 'src/app/utils/utils'; export const startMirage = ({ environment = 'development' } = {}) => { - const wsUrl = `ws://localhost:9091/api/notifications`; - const wsServer = new WSServer(wsUrl); + const wsUrl = new URL(window.location.href); + wsUrl.protocol = wsUrl.protocol.replace('http', 'ws'); + wsUrl.pathname = '/api/notifications'; + const wsServer = new WSServer(wsUrl.toString()); // Create a mock server socket to send notifications let websocket: Client; diff --git a/webpack.prod.js b/webpack.prod.js index eb79f1229..087700ad9 100644 --- a/webpack.prod.js +++ b/webpack.prod.js @@ -42,7 +42,7 @@ module.exports = merge(common('production'), { chunkFilename: '[name].[contenthash].bundle.css' // lazy-load css }), new EnvironmentPlugin({ - CRYOSTAT_AUTHORITY: '', + CRYOSTAT_AUTHORITY: process.env.PREVIEW ? 'http://localhost:8181' : '', PREVIEW: process.env.PREVIEW || 'false' }) ],