Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Update Readme for EE4 #50

Open
wants to merge 6 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
28 changes: 18 additions & 10 deletions config/config.dev.php
Original file line number Diff line number Diff line change
Expand Up @@ -2,22 +2,30 @@

/**
* Development config overrides & db credentials
*
*
* Our database credentials and any environment-specific overrides
*
*
* @package Focus Lab Master Config
* @version 1.1.1
* @version 2.2.0
* @author Focus Lab, LLC <[email protected]>
*/

$env_db['hostname'] = 'localhost';
$env_db['username'] = '';
$env_db['password'] = '';
$env_db['database'] = '';
$env_config['database'] = array (
'expressionengine' => array (
'hostname' => 'localhost',
'username' => '',
'password' => '',
'database' => '',
'dbdriver' => 'mysqli',
'dbprefix' => 'exp_',
'pconnect' => FALSE
),
);


$env_config['webmaster_email'] = '[email protected]';
// Local testing email address
$env_config['webmaster_email'] = '';


/* End of file config.dev.php */
/* Location: ./config/config.dev.php */
/* End of file config.local.php */
/* Location: ./config/config.local.php */
29 changes: 19 additions & 10 deletions config/config.env.php
Original file line number Diff line number Diff line change
Expand Up @@ -2,44 +2,53 @@

/**
* Environment Declaration
*
*
* This switch statement sets our environment. The environment is used primarily
* in our custom config file setup. It is also used, however, in the front-end
* index.php file and the back-end admin.php file to set the debug mode
*
*
* @package Focus Lab Master Config
* @version 1.1.1
* @version 2.2.0
* @author Focus Lab, LLC <[email protected]>
*/

if ( ! defined('ENV'))
{
$production = 'domain.com';
$staging = 'staging.domain.com';
$development = 'dev.domain.com';
$local = 'localhost';

switch (strtolower($_SERVER['HTTP_HOST'])) {
case 'domain.com' :
case $production:
define('ENV', 'prod');
define('ENV_FULL', 'Production');
define('ENV_DEBUG', FALSE);
define('ENV_DOMAIN', $production);
break;
case 'staging.domain.com' :

case $staging:
define('ENV', 'stage');
define('ENV_FULL', 'Staging');
define('ENV_DEBUG', FALSE);
define('ENV_DOMAIN', $staging);
break;
case 'dev.domain.com' :

case $development:
define('ENV', 'dev');
define('ENV_FULL', 'Development');
define('ENV_DEBUG', TRUE);
define('ENV_DOMAIN', $development);
break;

default :
default:
define('ENV', 'local');
define('ENV_FULL', 'Local');
define('ENV_DEBUG', TRUE);
define('ENV_DOMAIN', $local);
break;
}
}

/* End of file config.env.php */
/* Location: ./config/config.env.php */
/* Location: ./config/config.env.php */
38 changes: 16 additions & 22 deletions config/config.local.php
Original file line number Diff line number Diff line change
Expand Up @@ -2,37 +2,31 @@

/**
* Local config overrides & db credentials
*
*
* Our database credentials and any environment-specific overrides
* This file should be specific to each developer and not tracked in Git
*
*
* @package Focus Lab Master Config
* @version 1.1.1
* @version 2.2.0
* @author Focus Lab, LLC <[email protected]>
*/


// Local db
$env_db['hostname'] = 'localhost';
$env_db['username'] = '';
$env_db['password'] = '';
$env_db['database'] = '';

/**
* Remote db - typically a shared development database
*
* Putting this below the local settings allows us to easily uncomment the
* lines to connect to a secondary connection, overriding the first settings
*/
// $env_db['hostname'] = 'domain.com';
// $env_db['username'] = '';
// $env_db['password'] = '';
// $env_db['database'] = '';
$env_config['database'] = array (
'expressionengine' => array (
'hostname' => 'localhost',
'username' => '',
'password' => '',
'database' => '',
'dbdriver' => 'mysqli',
'dbprefix' => 'exp_',
'pconnect' => FALSE
),
);


// Local testing email address
$env_config['webmaster_email'] = '[email protected]';
$env_config['webmaster_email'] = '';


/* End of file config.local.php */
/* Location: ./config/config.local.php */
/* Location: ./config/config.local.php */
84 changes: 25 additions & 59 deletions config/config.master.php
Original file line number Diff line number Diff line change
Expand Up @@ -2,28 +2,28 @@

/**
* Focus Lab, LLC Master Config
*
*
* This is the master config file for our ExpressionEngine sites
* The settings will contain database credentials and numerous "config overrides"
* used throughout the site. This file is used as first point of configuration
* but there are environment-specific files as well. The idea is that the environment
* config files contain config overrides that are specific to a single environment.
*
*
* Some config settings are used in multiple (but not all) environments. You will
* see the use of conditionals around the ENV constant in this file. This constant is
* defined in ./config/config.env.php
*
*
* All config files are stored in the ./config/ directory and this master file is "required"
* in system/expressionengine/config/config.php and system/expressionengine/config/database.php
*
*
* require $_SERVER['DOCUMENT_ROOT'] . '/../config/config.master.php';
*
*
* This config setup is a combination of inspiration from Matt Weinberg and Leevi Graham
* @link http://eeinsider.com/articles/multi-server-setup-for-ee-2/
* @link http://ee-garage.com/nsm-config-bootstrap
*
*
* @package Focus Lab Master Config
* @version 1.1.1
* @version 2.1.1
* @author Focus Lab, LLC <[email protected]>
* @see https://github.com/focuslabllc/ee-master-config
*/
Expand All @@ -33,64 +33,31 @@
// already been loaded in index.php or admin.php
if ( ! defined('ENV'))
{
require 'config.env.php';
require 'config.env.php';
}


// Setup our initial arrays
$env_db = $env_config = $env_global = $master_global = array();


/**
* Database override magic
*
* If this equates to TRUE then we're in the database.php file
* We don't want these settings bothered with in our config.php file
*/
if (isset($db['expressionengine']))
{
/**
* Load our environment-specific config file
* which contains our database credentials
*
* @see config/config.local.php
* @see config/config.dev.php
* @see config/config.stage.php
* @see config/config.prod.php
*/
require 'config.' . ENV . '.php';

// Dynamically set the cache path (Shouldn't this be done by default? Who moves the cache path?)
$env_db['cachedir'] = APPPATH . 'cache/';

// Merge our database setting arrays
$db['expressionengine'] = array_merge($db['expressionengine'], $env_db);

// No need to have this variable accessible for the rest of the app
unset($env_db);
}
// End if (isset($db['expressionengine'])) {}



/**
* Config override magic
*
*
* If this equates to TRUE then we're in the config.php file
* We don't want these settings bothered with in our database.php file
*/
if (isset($config))
{

/**
* Dynamic path settings
*
*
* Make it easy to run the site in multiple environments and not have to switch up
* path settings in the database after each migration
* As inspired by Matt Weinberg: http://eeinsider.com/articles/multi-server-setup-for-ee-2/
*/
$protocol = (isset($_SERVER['HTTPS']) && $_SERVER['HTTPS'] == 'on') ? 'https://' : 'http://';
$base_url = $protocol . $_SERVER['HTTP_HOST'];
$base_url = $protocol . ENV_DOMAIN;
$base_path = $_SERVER['DOCUMENT_ROOT'];
$system_folder = APPPATH . '../';
$images_folder = 'images';
Expand Down Expand Up @@ -121,7 +88,7 @@

/**
* Custom upload directory paths
*
*
* The array keys must match the ID from exp_upload_prefs
*/
// $env_config['upload_preferences'] = array(
Expand All @@ -140,24 +107,23 @@

/**
* Template settings
*
*
* Working locally we want to reference our template files.
* In staging and production we do not use flat files (for ever-so-slightly better performance)
* This approach requires that we synchronize templates after each deployment of template changes
*
*
* For the distributed Focus Lab, LLC Master Config file this is commented out
* You can enable this "feature" by uncommenting the second 'save_tmpl_files' line
*/
$env_config['save_tmpl_files'] = 'y';
// $env_config['save_tmpl_files'] = (ENV == 'prod') ? 'n' : 'y';
$env_config['tmpl_file_basepath'] = $base_path . '/../templates';
$env_config['hidden_template_indicator'] = '_';
$env_config['hidden_template_indicator'] = '_';



/**
* Debugging settings
*
*
* These settings are helpful to have in one place
* for debugging purposes
*/
Expand All @@ -170,7 +136,7 @@
$env_config['template_debugging'] = (ENV_DEBUG) ? 'y' : 'n' ;
/**
* Set debug to '2' if we're in dev mode, otherwise just '1'
*
*
* 0: no PHP/SQL errors shown
* 1: Errors shown to Super Admins
* 2: Errors shown to everyone
Expand All @@ -181,7 +147,7 @@

/**
* Tracking & Performance settings
*
*
* These settings may impact what happens on certain page loads
* and turning them off could help with performance in general
*/
Expand All @@ -200,7 +166,7 @@
/**
* 3rd Party Add-on config items as needed
*/




Expand All @@ -226,7 +192,7 @@
/**
* Load our environment-specific config file
* May contain override values from similar above settings
*
*
* @see config/config.local.php
* @see config/config.dev.php
* @see config/config.stage.php
Expand All @@ -239,7 +205,7 @@

/**
* Setup our template-level global variables
*
*
* As inspired by NSM Bootstrap Config
* @see http://ee-garage.com/nsm-config-bootstrap
*/
Expand All @@ -248,7 +214,7 @@
{
$assign_to_config['global_vars'] = array();
}

// Start our array with environment variables. This gives us {global:env} and {global:env_full} tags for our templates.
$master_global = array(
'global:env' => ENV,
Expand All @@ -259,17 +225,17 @@

/**
* Merge arrays to form final datasets
*
*
* We've created our base config and global key->value stores
* We've also included the environment-specific arrays now
* Here we'll merge the arrays to create our final array dataset which
* respects "most recent data" first if any keys are duplicated
*
*
* This is how our environment settings are "king" over any defaults
*/
$assign_to_config['global_vars'] = array_merge($assign_to_config['global_vars'], $master_global, $env_global); // global var arrays
$config = array_merge($config, $env_config); // config setting arrays

}
// End if (isset($config)) {}

Expand Down
Loading