Exemplo n.º 1
0
 public static function set_constants()
 {
     if (!self::$constants_set) {
         // Transfer environmental vars to constants
         $env = getenv('APPLICATION_ENV');
         if (!$env) {
             $env = 'production';
         }
         if (!defined('APPLICATION_ENV')) {
             define('APPLICATION_ENV', $env);
         }
         if (!defined('PATH')) {
             define('PATH', getenv('PATH'));
         }
         if (!defined('SS_SEND_ALL_EMAILS_TO')) {
             define('SS_SEND_ALL_EMAILS_TO', getenv('SS_SEND_ALL_EMAILS_TO'));
         }
         // Set SS env vars
         if (!getenv('SS_ENVIRONMENT_TYPE')) {
             putenv('SS_ENVIRONMENT_TYPE=' . self::$ss_env[APPLICATION_ENV]);
             define('SS_ENVIRONMENT_TYPE', getenv('SS_ENVIRONMENT_TYPE'));
         }
         self::$constants_set = true;
         self::$application_env = APPLICATION_ENV;
         self::$ss_environment_type = self::$ss_env[APPLICATION_ENV];
     }
 }
Exemplo n.º 2
0
<?php

// parse the config file and env vars
require_once __DIR__ . '/../lib/ss_loadconf.php';
$ss_cnf = SS_LoadConf::conf();
global $_FILE_TO_URL_MAPPING;
$_FILE_TO_URL_MAPPING[$ss_cnf->public_path] = $ss_cnf->url;
Exemplo n.º 3
0
        Security::setDefaultAdmin('admin', 'admin');
        // Log file
        SS_Log::add_writer(new SS_LogFileWriter(BASE_PATH . '/../log/staging.log'), SS_Log::WARN, '<=');
        break;
    default:
    case 'production':
        Director::set_environment_type("live");
        // Log file
        SS_Log::add_writer(new SS_LogFileWriter(BASE_PATH . '/../log/production.log'), SS_Log::WARN, '<=');
        break;
}
// --------------------------------- //
// Allow override in dev and stage mode for testing asset pipeline
// --------------------------------- //
if (!empty($_GET['env']) && (APPLICATION_ENV == 'staging' || APPLICATION_ENV == 'development')) {
    Director::set_environment_type(SS_LoadConf::translate_env($_GET['env']));
}
// --------------------------------- //
// DB
// --------------------------------- //
$databaseConfig = array("type" => 'MySQLDatabase', "server" => $ss_cnf->db->host, "username" => $ss_cnf->db->user, "password" => $ss_cnf->db->pass, "database" => $ss_cnf->db->name, "path" => '');
Config::inst()->update('MySQLDatabase', 'connection_charset', 'utf8');
// --------------------------------- //
// Mail
// --------------------------------- //
SmtpMailer::set_conf($ss_cnf->mail);
// --------------------------------- //
// Misc
// --------------------------------- //
// Set the site locale
i18n::set_locale('en_NZ');