I'll create an array and parse the elements of the base url into it, using slashes as delimiters. The Pantheon specific part will be to know which of those elements to assign to SITE and ENVIRONMENT, but is one step toward genericity.