Skip to content

Bootstrap

Mark edited this page Apr 19, 2014 · 4 revisions

My application bootstrap usually looks like this:

// Load plugins
CakePlugin::loadAll(array(
		'Tools' => array('bootstrap' => true
));
// OR if load() is used:
// CakePlugin::load('Tools', array('bootstrap' => true));

// Optionally, when using Auth
App::uses('Auth', 'Tools.Lib');

Furthermore I also include configs via configs.php and configs_private.php (excluded from version control!):

Configure::load('configs'); // Needs at least 1 $config[] array to work

define('CONFIGS_PRIVATE', dirname(__FILE__) . DS . 'configs_private.php');
if (file_exists(CONFIGS_PRIVATE)) {
	require_once CONFIGS_PRIVATE;
}

My configs.php usually contains all the configs including an empty string for sensitive information:

$config['SomeWebservice'] = array(
	'username' => 'foo',
	'apiKey', ''
);

The configs_private.php then contains overwrites those keys that are not supposed to be version controlled:

Configure::write('SomeWebservice.apiKey', 'xyz');

Also see cakephp-bootstrap-goodies

Clone this wiki locally