Ejemplo n.º 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 = Pii::includeIfExists(__DIR__ . KEYS_CONFIG_PATH, true) ?: array();
/** @noinspection PhpIncludeInspection */
if (false !== ($_salts = Pii::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
Ejemplo n.º 2
0
    if (!empty($_envConfig) && is_array($_envConfig)) {
        foreach ($_envConfig as $_key => $_value) {
            if (!is_string($_value)) {
                $_value = json_encode($_value);
            }
            if (false === putenv($_key . '=' . $_value)) {
                Log::error('Error setting environment variable: ' . $_key . ' = ' . $_value);
            }
        }
    }
}
/**
 * Load up the database configuration, free edition, private hosted, or others.
 * Look for non-default database config to override.
 */
if (false === ($_dbConfig = Pii::includeIfExists(__DIR__ . DATABASE_CONFIG_PATH, true))) {
    if (Fabric::fabricHosted()) {
        $_fabricHosted = true;
        list($_dbConfig, $_metadata) = Fabric::initialize();
    } else {
        /**
         * Database names vary by type of DSP:
         *
         *        1. Free Edition/Hosted:   DSP name
         *        2. Hosted Private:        hpp_<DSP Name>
         *        3. All others:            dreamfactory or whatever is in non-default config.
         */
        if (false !== ($_host = Fabric::hostedPrivatePlatform(true))) {
            $_dbName = 'hpp_' . str_ireplace(array('.dreamfactory.com', '-', '.cloud', '.'), array(null, '_', null, '_'), $_host);
        } else {
            $_dbName = 'dreamfactory';