Making the test page URL dynamic depending on the environment
This commit is contained in:
parent
330a795fee
commit
7f79c2dc4a
2
.github/workflows/build-and-deploy.yml
vendored
2
.github/workflows/build-and-deploy.yml
vendored
@ -199,4 +199,4 @@ jobs:
|
|||||||
env:
|
env:
|
||||||
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
|
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
|
||||||
with:
|
with:
|
||||||
msg: Environment deployed at https://play-${{ env.GITHUB_HEAD_REF_SLUG }}.test.workadventu.re
|
msg: "Environment deployed at https://play-${{ env.GITHUB_HEAD_REF_SLUG }}.test.workadventu.re \nTests available at https://maps-${{ env.GITHUB_HEAD_REF_SLUG }}.test.workadventu.re/tests"
|
||||||
|
@ -4,7 +4,7 @@
|
|||||||
</head>
|
</head>
|
||||||
<body>
|
<body>
|
||||||
<label>Base test URL:</label>
|
<label>Base test URL:</label>
|
||||||
<input id="baseurl" type="text" value="http://play.workadventure.localhost/_/global/maps.workadventure.localhost/tests/" />
|
<input id="baseurl" type="text" value="" />
|
||||||
<table>
|
<table>
|
||||||
<tr>
|
<tr>
|
||||||
<th>Result</th>
|
<th>Result</th>
|
||||||
@ -166,6 +166,21 @@
|
|||||||
|
|
||||||
<script>
|
<script>
|
||||||
const baseInput = document.getElementById('baseurl');
|
const baseInput = document.getElementById('baseurl');
|
||||||
|
|
||||||
|
let host = window.location.host;
|
||||||
|
let playHost;
|
||||||
|
if (host.startsWith('maps-')) {
|
||||||
|
playHost = 'play-'+host.substr(5);
|
||||||
|
} else if (host.startsWith('maps.')) {
|
||||||
|
playHost = 'play.'+host.substr(5);
|
||||||
|
} else {
|
||||||
|
playHost = 'localhost';
|
||||||
|
}
|
||||||
|
|
||||||
|
let completeUrl = window.location.protocol + '//' + playHost + '/_/global/' + host + window.location.pathname;
|
||||||
|
|
||||||
|
baseInput.value = completeUrl;
|
||||||
|
|
||||||
baseInput.addEventListener('change', init);
|
baseInput.addEventListener('change', init);
|
||||||
|
|
||||||
function init() {
|
function init() {
|
||||||
|
Loading…
Reference in New Issue
Block a user