Skip to content

Instantly share code, notes, and snippets.

@jtrascap
Created November 11, 2015 16:23
Show Gist options
  • Save jtrascap/688d35aa8d29ea7f659b to your computer and use it in GitHub Desktop.
Save jtrascap/688d35aa8d29ea7f659b to your computer and use it in GitHub Desktop.
ExpressionEngine 3 Config
<?php if (! defined('BASEPATH')) exit('No direct script access allowed');
$db['username'] = 'xxxxxxxxxxxxxx';
$db['password'] = 'xxxxxxxxxxxxxx';
$db['database'] = 'xxxxxxxxxxxxxx';
<?php if (! defined('BASEPATH')) exit('No direct script access allowed');
$showProfiler = 'n';
$showTemplateDebugging = 'n';
// Define Environment
if (! defined('ENV')) {
switch ($_SERVER['SERVER_NAME']) {
case 'site.com':
define('ENV', 'prod');
break;
case 'something.site.com':
define('ENV', 'stage');
break;
default:
define('ENV', 'local');
}
}
// Domain and protocol logic
$secure = isset($_SERVER['HTTPS']) && $_SERVER['HTTPS'] === 'on';
$protocol = $secure ? 'https://' : 'http://';
$root = $protocol . $_SERVER['SERVER_NAME'];
$cdnUrl = (ENV === 'prod') ? 'https://cdn.site.com' : $root;
$assetUrl = $cdnUrl . '/assets';
$global = array();
// Do not show PHP errors
$config['debug'] = '0';
// Set up the database
$db = array(
'hostname' => 'localhost',
'dbdriver' => 'mysqli',
'dbprefix' => 'exp_',
'pconnect' => FALSE
);
switch (ENV) {
case 'prod':
$db['username'] = 'xxxxxxxxxxxxxx';
$db['password'] = 'xxxxxxxxxxxxxx';
$db['database'] = 'xxxxxxxxxxxxxx';
break;
case 'stage':
$db['username'] = 'xxxxxxxxxxxxxx';
$db['password'] = 'xxxxxxxxxxxxxx';
$db['database'] = 'xxxxxxxxxxxxxx';
break;
case 'local':
// Show full error reporting if local environment
$config['debug'] = '2';
require 'config.local.php';
}
// Set the database array to the config
$config['database'] = array (
'expressionengine' => $db,
);
unset($db);
// Global variables
$global['global:asset_url'] = $assetUrl;
$global['global:cdn_url'] = $cdnUrl;
$global['global:date_format'] = '%F %j, %Y';
$global['global:env'] = ENV;
// Cache settings
$config['cache_driver'] = 'memcached';
$config['memcached'] = array(
'host' => '127.0.0.1',
'port' => 11211,
'weight' => 1
);
$config['cache_driver_backup'] = 'file';
// Email settings
$mandrillKey = 'xxxxxxxxxxxxxx';
$config['mail_protocol'] = 'smtp';
$config['smtp_server'] = 'smtp.mandrillapp.com';
$config['smtp_port'] = '587';
$config['smtp_username'] = 'someemail@site.com';
$config['smtp_password'] = $mandrillKey;
// Dynamic path settings
$baseUrl = $protocol . $_SERVER['HTTP_HOST'];
$basePath = $_SERVER['DOCUMENT_ROOT'];
$imagesFolder = 'images';
$imagesPath = $basePath . DIRECTORY_SEPARATOR . $imagesFolder;
$imagesUrl = $baseUrl . '/' . $imagesFolder;
$uploadsPath = $basePath . DIRECTORY_SEPARATOR . 'uploads' . DIRECTORY_SEPARATOR;
$config['site_index'] = '';
$config['site_url'] = $root;
$config['cp_url'] = $root . '/admin.php';
$config['theme_folder_path'] = $basePath . '/themes/';
$config['theme_folder_url'] = $baseUrl . '/themes/';
$config['captcha_path'] = $imagesPath . '/captchas/';
$config['captcha_url'] = $imagesUrl . '/captchas/';
$config['avatar_path'] = $imagesPath . '/avatars/';
$config['avatar_url'] = $imagesUrl . '/avatars/';
// Cookie & session settings
$config['cookie_domain'] = '';
$config['cookie_httponly'] = 'y';
$config['cookie_prefix'] = ENV;
$config['cookie_path'] = '';
$config['website_session_type'] = 'c';
// Include upload preferences
require_once 'config.upload-preferences.php';
// Template settings
$config['save_tmpl_files'] = 'y';
// Debugging
$config['show_profiler'] = $showProfiler;
$config['template_debugging'] = $showTemplateDebugging;
// Tracking & performance settings
$config['disable_all_tracking'] = 'y';
$config['enable_hit_tracking'] = 'n';
$config['log_referrers'] = 'n';
$config['autosave_interval_seconds'] = '0';
// Control Panel
$config['cp_session_type'] = 'c';
$config['rte_enabled'] = 'n';
// General settings
$config['is_system_on'] = 'y';
$config['allow_extensions'] = 'y';
$config['profile_trigger'] = 'xxxxxxxxxxxxxx';
$config['use_category_name'] = 'n';
$config['reserved_category_word'] = '';
$config['enable_emoticons'] = 'n';
$config['site_404'] = 'site/_404';
$config['encryption_key'] = 'xxxxxxxxxxxxxx';
// Setup template-level global variables
global $assign_to_config;
if (! isset($assign_to_config['global_vars'])) {
$assign_to_config['global_vars'] = array();
}
$assign_to_config['global_vars'] = array_merge(
$assign_to_config['global_vars'],
$global
);
// ExpressionEngine config items
$config['app_version'] = '3.0.0';
$config['doc_url'] = 'https://ellislab.com/expressionengine/user-guide/';
$config['multiple_sites_enabled'] = 'n';
// END EE config items
// CodeIgniter config items
$config['uri_protocol'] = 'AUTO';
$config['charset'] = 'UTF-8';
$config['subclass_prefix'] = 'EE_';
$config['log_threshold'] = 0;
$config['log_date_format'] = 'Y-m-d H:i:s';
$config['rewrite_short_tags'] = TRUE;
// END CodeIgniter config items
<?php if (! defined('BASEPATH')) exit('No direct script access allowed');
// Custom upload directory paths (array keys must match directory ids)
$config['upload_preferences'] = array(
4 => array(
'name' => 'General',
'server_path' => $uploadsPath . 'general' . DIRECTORY_SEPARATOR,
'url' => '/uploads/general/'
)
);
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment