Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- <?php
- $debugMode = FALSE;
- $httpHost = isset($_SERVER['HTTP_HOST']) ? $_SERVER['HTTP_HOST'] : (isset($_SERVER['GITLAB_CI']) ? 'GITLAB_CI-' .$_SERVER['CI_COMMIT_REF_NAME'] : (PHP_SAPI === 'cli' ? 'cli' : 'localhost'));
- $configSection = 'production';
- $storageDir = INDEX_DIR . '/storage';
- $debugModeSetup = array(
- '*.dev.andweb.cz' => TRUE,
- '*.test.andweb.cz' => TRUE,
- '*.dev7.andweb.cz' => TRUE,
- '*.test7.andweb.cz' => TRUE,
- '*.local' => TRUE,
- 'GITLAB_CI-*' => TRUE,
- 'cli' => TRUE,
- );
- $configSectionSetup = array(
- '*.dev.andweb.cz' => 'development',
- '*.dev7.andweb.cz' => 'development',
- '*.local' => 'development',
- '*.test.andweb.cz' => 'development', // 'development'
- '*.test7.andweb.cz' => 'development', // 'development'
- '*.pripravujeme.eu' => 'development',
- 'GITLAB_CI-www' => 'production',
- 'GITLAB_CI-*' => 'development',
- 'cli' => 'development',
- );
- $storageDirSetup = array(
- '*.dev.andweb.cz' => 'http://cukrarstvi-viktoriacz.pripravujeme.eu/storage',
- '*.dev7.andweb.cz' => 'http://cukrarstvi-viktoriacz.pripravujeme.eu/storage',
- '*.local' => 'http://cukrarstvi-viktoriacz.pripravujeme.eu/storage',
- );
- if (defined('ANDWEB_DEBUG_MODE')) {
- $debugMode = ANDWEB_DEBUG_MODE;
- } else {
- foreach($debugModeSetup as $domain => $enable) {
- if(fnmatch($domain, $httpHost)) {
- $debugMode = $enable;
- break;
- }
- }
- }
- // enable debug mode if want
- if (isset($_GET) && isset($_GET['debugMode']) && $_GET['debugMode'] == 1) {
- $debugMode = TRUE;
- }
- foreach ($configSectionSetup as $domain => $section) {
- if (fnmatch($domain, $httpHost)) {
- $configSection = $section;
- break;
- }
- }
- foreach ($storageDirSetup as $domain => $storageDirCandidate) {
- if (fnmatch($domain, $httpHost)) {
- $storageDir = $storageDirCandidate;
- break;
- }
- }
- define('STORAGE_DIR', $storageDir);
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement