Created
September 27, 2016 22:08
-
-
Save brianyoungblood/583fb75a90e55b55bba5460ca3a639e4 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
//$server_name = $_SERVER["SERVER_NAME"] | |
$server_name = "3b38a450c-92602-463c8-5581855-84c64c57741f--pr-389.probo.build"; | |
// Get parts of the domain to use subdomain later. | |
$domain_parts = explode('.',$server_name); | |
// These match keys elsewhere on the site. MUST be exactly like this. | |
$regions = array('europe', 'global','laes','latin_america_es','latin_america_pt','us_canada','asia', 'default'); | |
$subdomain_parts = explode('--', $domain_parts[0]); | |
$matches['BUID'] = array_shift($subdomain_parts); | |
foreach($subdomain_parts as $value) { | |
$values = explode('-', $value); | |
$matches[strtoupper($values[0])] = $values[1]; | |
} | |
$probo_base_domain = $matches['BUID']; | |
$probo_pr = ""; | |
if(isset($matches['PR'])) { | |
$probo_base_domain = $probo_base_domain . '--pr-' . $matches['PR']; | |
$probo_pr = $matches['PR']; | |
} | |
// Create/Overwrite variable and define a default site region without any site wildcards. The site initially loads without a site-[wildcard]. | |
$conf['domains_regions'][$probo_base_domain] = 'default'; | |
// Loop regions and create the needed domain_regions array - replace underscores | |
// results are something like this. ie $conf['domains_regions']['https://3b38a40c-9602-46c8-8bc8-84c64c57741f--pr-371--site-asia.probo.build/'] = 'asia'; | |
foreach ($regions as $region) { | |
$conf['domains_regions'][$probo_base_domain . '--site-' . $region . '.probo.build'] = $region; | |
} | |
print_r($conf['domains_regions']); | |
?> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment