Don't use CI_PAGES_URL after all

This commit is contained in:
Alex Gleason 2021-09-02 17:09:42 -05:00
parent 446b9b9bb1
commit 39132d7e0e
No known key found for this signature in database
GPG key ID: 7211D1F99744FBB7

View file

@ -9,7 +9,6 @@ const { trimEnd } = require('lodash');
const {
BACKEND_URL,
FE_BASE_PATH,
CI_PAGES_URL,
} = process.env;
const sanitizeURL = url => {
@ -21,21 +20,8 @@ const sanitizeURL = url => {
};
// Run Soapbox FE from a subdirectory.
// If FE_BASE_PATH (eg '/web') is provided, prefer it.
// For GitLab Pages builds, CI_PAGES_URL will be used.
const getFeBasePath = () => {
if (FE_BASE_PATH) {
return trimEnd(FE_BASE_PATH, '/');
} else if (CI_PAGES_URL) {
try {
const { pathname } = new URL(CI_PAGES_URL);
return trimEnd(pathname, '/');
} catch {
return '/';
}
} else {
return '/';
}
return trimEnd(FE_BASE_PATH, '/') || '/';
};
// JSON.parse/stringify is to emulate what @preval is doing and avoid any