workadventure/tests/tests/utils/debug.ts

32 lines
875 B
TypeScript
Raw Normal View History

2021-12-03 09:28:30 +01:00
import axios from "axios";
const fs = require('fs');
2021-12-03 09:28:30 +01:00
2021-12-06 16:37:27 +01:00
const ADMIN_API_TOKEN = process.env.ADMIN_API_TOKEN;
2021-12-03 09:28:30 +01:00
export async function getPusherDump(): Promise<any> {
2021-12-06 16:37:27 +01:00
let url = 'http://pusher.workadventure.localhost/dump?token='+ADMIN_API_TOKEN;
if (fs.existsSync('/project')) {
// We are inside a container. Let's use a direct route
2021-12-06 16:37:27 +01:00
url = 'http://pusher:8080/dump?token='+ADMIN_API_TOKEN;
}
2021-12-03 09:28:30 +01:00
return (await axios({
url,
2021-12-03 09:28:30 +01:00
method: 'get',
})).data;
}
export async function getBackDump(): Promise<any> {
2021-12-06 16:37:27 +01:00
let url = 'http://api.workadventure.localhost/dump?token='+ADMIN_API_TOKEN;
if (fs.existsSync('/project')) {
// We are inside a container. Let's use a direct route
2021-12-06 16:37:27 +01:00
url = 'http://back:8080/dump?token='+ADMIN_API_TOKEN;
}
2021-12-03 09:28:30 +01:00
return (await axios({
url,
2021-12-03 09:28:30 +01:00
method: 'get',
})).data;
}