Changing pusher / back URL depending on environment
This commit is contained in:
parent
44c4b4fc34
commit
15565c9a29
@ -1,16 +1,29 @@
|
|||||||
import axios from "axios";
|
import axios from "axios";
|
||||||
|
const fs = require('fs');
|
||||||
|
|
||||||
export async function getPusherDump(): Promise<any> {
|
export async function getPusherDump(): Promise<any> {
|
||||||
|
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({
|
return (await axios({
|
||||||
url: 'http://pusher.workadventure.localhost/dump?token=123',
|
url,
|
||||||
method: 'get',
|
method: 'get',
|
||||||
})).data;
|
})).data;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
export async function getBackDump(): Promise<any> {
|
export async function getBackDump(): Promise<any> {
|
||||||
|
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({
|
return (await axios({
|
||||||
url: 'http://api.workadventure.localhost/dump?token=123',
|
url,
|
||||||
method: 'get',
|
method: 'get',
|
||||||
})).data;
|
})).data;
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user