App = $App; $this->_set_prefix(); if ($this->getEnvShortName() != 'prod') { $this->_set_debug_mode(TRUE); } } /** * Get eclipse.org cookie domain and prefix based off the current environment * * @return array */ public function getEclipseEnv(){ // @todo: allowed_hosts is deprecated $server['dev'] = array( 'shortname' => 'local', 'cookie' => '.dev.docker', 'domain' => 'www.eclipse.php53.dev.docker', 'dev_domain' => 'dev_eclipse.php53.dev.docker', 'accounts' => 'accounts.php55.dev.docker', 'api' => 'api.php55.dev.docker', 'allowed_hosts' => array( 'eclipse.local', 'www.eclipse.local', 'dev.eclipse.local', 'docker.local' ), ); $server['staging'] = array( 'shortname' => 'staging', 'cookie' => '.eclipse.org', 'domain' => 'staging.eclipse.org', // We currently dont have a staging server for dev.eclipse.org 'dev_domain' => 'dev.eclipse.org', 'accounts' => 'accounts-staging.eclipse.org', 'api' => 'api-staging.eclipse.org', 'allowed_hosts' => array( 'staging.eclipse.org' ), ); $server['prod'] = array( 'shortname' => 'prod', 'cookie' => '.eclipse.org', 'domain' => 'www.eclipse.org', 'dev_domain' => 'dev.eclipse.org', 'accounts' => 'accounts.eclipse.org', 'api' => 'api.eclipse.org', 'allowed_hosts' => array( // Empty, since it's the default. ), ); if (strpos($_SERVER['HTTP_HOST'], '.docker') !== FALSE) { return $server['dev']; } if (strpos($_SERVER['HTTP_HOST'], 'staging') !== FALSE) { return $server['staging']; } return $server['prod']; } /** * Get shortname */ public function getEnvShortName(){ $domain = $this->getEclipseEnv(); return $domain['shortname']; } /** * Get debug mode value * * @return Ambigous */ public function _get_debug_mode() { return $this->debug_mode; } /** * Get domain prefix */ protected function _get_prefix_domain() { return $this->prefix_domain; } /** * Get devdomain prefix */ protected function _get_prefix_devdomain() { return $this->prefix_devdomain; } /** * Get cookie prefix */ protected function _get_prefix_cookie() { return $this->prefix_cookie; } /** * Enable/disable debug/sandbox mode */ protected function _set_debug_mode($debug_mode = FALSE){ $this->debug_mode = $debug_mode; } /** * Set Eclipse domain and Eclipse cookie domain */ protected function _set_prefix() { $domain = $this->getEclipseEnv(); $this->prefix_domain = $domain['domain']; $this->prefix_devdomain = $domain['dev_domain']; $this->prefix_cookie = $domain['cookie']; } }