示例#1
0
$_logFileName = basename(\Kisma::get('app.log_file_name'));
//  Finally the name of our app
$_appName = 'DreamFactory Services Platform';
//  Ensure the assets path exists so Yii doesn't puke.
$_assetsPath = $_docRoot . '/assets';
if (!is_dir($_assetsPath)) {
    @mkdir($_assetsPath, 0777, true);
}
/**
 * Keys and salts
 */
$_dspSalts = array();
//  Load some keys
$_keys = Includer::includeIfExists(__DIR__ . KEYS_CONFIG_PATH, true) ?: array();
/** @noinspection PhpIncludeInspection */
if (false !== ($_salts = Includer::includeIfExists(__DIR__ . SALT_CONFIG_PATH, true))) {
    if (!empty($_salts)) {
        foreach ($_salts as $_key => $_salt) {
            if ($_salt) {
                $_dspSalts['dsp.salts.' . $_key] = $_salt;
            }
        }
    }
    unset($_salts);
}
/**
 * Application Paths
 */
\Kisma::set(array('app.app_name' => $_appName, 'app.project_root' => $_basePath, 'app.vendor_path' => $_vendorPath, 'app.log_path' => $_logFilePath, 'app.log_file_name' => $_logFileName, 'app.install_type' => array($_installType => $_installName), 'app.fabric_hosted' => $_fabricHosted, 'app.doc_root' => $_docRoot));
/**
 * Database Caching
示例#2
0
 /**
  * Retrieve/Create the CORS configuration for this request
  */
 protected function _loadConfig()
 {
     //  Cached? Pull it out
     if ($this->_cache && false !== ($_list = $this->_cache->fetch($this->_id))) {
         $_whitelist = $_list;
     } else {
         //  Empty whitelist...
         $_whitelist = [];
         //	Get CORS data from config file
         $_configFile = $this->_configPath . static::DEFAULT_CONFIG_FILE;
         if (false !== ($_config = Includer::includeIfExists($_configFile))) {
             if (false === ($_whitelist = json_decode($_config, true)) || JSON_ERROR_NONE != json_last_error()) {
                 throw new \RuntimeException('The CORS configuration file is corrupt. Cannot continue.');
             }
             $this->_logger->debug('CORS: configuration loaded. Whitelist = ' . print_r($_whitelist, true));
         }
     }
     //  Cache/re-cache if we can
     $this->_cache && $this->_cache->save(static::WHITELIST_KEY, $_whitelist, static::CACHE_TTL) && $this->_logger->debug('whitelist cached');
     //  Set member
     $this->_whitelist = $_whitelist;
 }