From 15565c9a29862f69fb2d3b51f67057b976ed4203 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?David=20N=C3=A9grier?= Date: Mon, 6 Dec 2021 15:29:24 +0100 Subject: [PATCH] Changing pusher / back URL depending on environment --- tests/tests/utils/debug.ts | 17 +++++++++++++++-- 1 file changed, 15 insertions(+), 2 deletions(-) diff --git a/tests/tests/utils/debug.ts b/tests/tests/utils/debug.ts index c29ac5b0..50eaa522 100644 --- a/tests/tests/utils/debug.ts +++ b/tests/tests/utils/debug.ts @@ -1,16 +1,29 @@ import axios from "axios"; +const fs = require('fs'); export async function getPusherDump(): Promise { + let url = 'http://pusher.workadventure.localhost/dump?token=123'; + if (fs.existsSync('/project')) { + // We are inside a container. Let's use a direct route + url = 'http://pusher/dump?token=123'; + } + return (await axios({ - url: 'http://pusher.workadventure.localhost/dump?token=123', + url, method: 'get', })).data; } export async function getBackDump(): Promise { + let url = 'http://api.workadventure.localhost/dump?token=123'; + if (fs.existsSync('/project')) { + // We are inside a container. Let's use a direct route + url = 'http://back/dump?token=123'; + } + return (await axios({ - url: 'http://api.workadventure.localhost/dump?token=123', + url, method: 'get', })).data; }