예제 #1
0
 public function testDetect()
 {
     $env = Environment::detect();
     $this->assertEquals('development', $env);
     putenv("PHP_ROXPHP_ENV=production");
     $env = Environment::detect();
     $this->assertEquals('production', $env);
 }
예제 #2
0
/**
 * RoxPHP
 *
 * Copyright (C) 2008 - 2012 Ramon Torres
 *
 * Licensed under The MIT License
 * Redistributions of files must retain the above copyright notice.
 *
 * @copyright Copyright (c) 2008 - 2012 Ramon Torres
 * @package App
 * @license The MIT License (http://www.opensource.org/licenses/mit-license.php)
 */
use rox\active_record\ConnectionManager;
use rox\util\Environment;
switch (Environment::get()) {
    /*
    case 'production':
    	// Production database configuration
    	ConnectionManager::setConfig('default', array(
    		'host'     => '127.0.0.1',
    		'username' => 'root',
    		'password' => '',
    		'database' => 'rox_app'
    	));
    	break;
    
    case 'staging':
    	// Development database configuration
    	ConnectionManager::setConfig('default', array(
    		'host'     => '127.0.0.1',
예제 #3
0
<?php

use rox\util\Environment;
$environment = Environment::detect();
require_once __DIR__ . "/environments/{$environment}.php";