Skip to content

Instantly share code, notes, and snippets.

@thomasthesecond
Created September 23, 2014 13:54
Show Gist options
  • Save thomasthesecond/2aa4efb14e42e2a4c679 to your computer and use it in GitHub Desktop.
Save thomasthesecond/2aa4efb14e42e2a4c679 to your computer and use it in GitHub Desktop.
Configuration files for Craft CMS
<?php
/**
* Database Configuration
*
* All of your system's database configuration settings go in here.
* You can see a list of the default settings in craft/app/etc/config/defaults/db.php
*/
return array(
'*' => array(
'tablePrefix' => 'craft',
'database' => 'xxx_craft'
),
'local' => array(
'server' => 'localhost',
'user' => 'root',
'password' => ''
),
'dev' => array(
'server' => '',
'user' => 'root',
'password' => ''
),
'staging' => array(
'server' => '',
'user' => 'root',
'password' => ''
),
'production' => array(
'server' => '',
'user' => '',
'password' => ''
)
);
<?php
/**
* General Configuration
*
* All of your system's general configuration settings go in here.
* You can see a list of the default settings in craft/app/etc/config/defaults/general.php
*/
return array(
'*' => array(),
'local' => array(
'devMode' => true,
'useCompressedJs' => false
),
'dev' => array(
'devMode' => true,
'useCompressedJs' => false
),
'staging' => array(
'devMode' => true,
'useCompressedJs' => true
),
'production' => array(
'devMode' => false,
'useCompressedJs' => true
)
);
<?php
/**
* Enhanced Foolproof Multi-Environment Config
*
* This code snippet supports dynamic environment configuration using
* either the APP_ENV environment variable, or “Laravel-style” server
* name resolution as a fallback.
*
* http://craftcookbook.net/recipes/273
*/
define('CRAFT_ENVIRONMENT', call_user_func_array(function ($environments, $fallback)
{
if (array_key_exists('APP_ENV', $_SERVER) && in_array($environment = $_SERVER['APP_ENV'], array_keys($environments)))
{
return $environment;
}
foreach ($environments as $environment => $value)
{
$serverName = $_SERVER['SERVER_ADDR'];
if ((is_array($value) && in_array($serverName, $value)) || $e == $value) {
return $environment;
}
}
return $fallback;
}, array(
// Environment Definitions
array(
'local' => array('127.0.0.1'),
'dev' => array(''),
'staging' => array(''),
'production' => array(''),
),
// Default Environment
'production',
)));
// Path to your craft/ folder
$craftPath = '../../../craft';
// Move templates path above web root
define('CRAFT_TEMPLATES_PATH', realpath(__DIR__.'/../../../templates/'));
// Do not edit below this line
$path = rtrim($craftPath, '/').'/app/index.php';
if (!is_file($path))
{
exit('Could not find your craft/ folder. Please ensure that <strong><code>$craftPath</code></strong> is set correctly in '.__FILE__);
}
require_once $path;
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment