Add support for alternative download domain #3
@ -284,15 +284,17 @@ class BuildsRenderer {
|
|||||||
stringContains($_SERVER['REQUEST_URI'], "bpy")) ?
|
stringContains($_SERVER['REQUEST_URI'], "bpy")) ?
|
||||||
"/download/daily" : strtok($_SERVER['REQUEST_URI'], '?');
|
"/download/daily" : strtok($_SERVER['REQUEST_URI'], '?');
|
||||||
|
|
||||||
$env_id = getEnvId();
|
|
||||||
|
|
||||||
$protocol = "https";
|
$protocol = "https";
|
||||||
$host_id = getHostId();
|
|
||||||
|
|
||||||
|
$env_id = getEnvId();
|
||||||
|
|||||||
if (! in_array($env_id, array("UATEST", "PROD"))) {
|
if (! in_array($env_id, array("UATEST", "PROD"))) {
|
||||||
$protocol = (isset($_SERVER['HTTPS']) && $_SERVER['HTTPS'] === 'on' ? "https" : "http");
|
$protocol = (isset($_SERVER['HTTPS']) && $_SERVER['HTTPS'] === 'on' ? "https" : "http");
|
||||||
}
|
}
|
||||||
$uri = $protocol . "://$host_id" . "$request_uri";
|
|
||||||
|
// Use specific host provided for file downloads if present, otherwise serve
|
||||||
|
// files from the same domain as the website itself.
|
||||||
|
$download_host = getenv('DOWNLOAD_FILE_DOMAIN') ?: getHostId();
|
||||||
|
$uri = $protocol . "://$download_host" . "$request_uri";
|
||||||
|
|
||||||
$escaped_file_name = htmlspecialchars($build->file_name);
|
$escaped_file_name = htmlspecialchars($build->file_name);
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user
The environment ID depends on
getHostId()
. If the host ID is somehow to depend on configuration, it needs to be consistently handled ingetHostId()