Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

test(mirage): correct server authority string in preview builds (backport #1283) #1285

Merged
merged 1 commit into from
Jun 12, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 4 additions & 3 deletions src/mirage/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down
2 changes: 1 addition & 1 deletion webpack.prod.js
Original file line number Diff line number Diff line change
Expand Up @@ -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'
})
],
Expand Down
Loading