<?php  if ( ! defined('BASEPATH')) exit('No direct script access allowed');
/*
| -------------------------------------------------------------------
| DATABASE CONNECTIVITY SETTINGS
| -------------------------------------------------------------------
| This file will contain the settings needed to access your database.
|
| For complete instructions please consult the 'Database Connection'
| page of the User Guide.
|
| -------------------------------------------------------------------
| EXPLANATION OF VARIABLES
| -------------------------------------------------------------------
|
|    ['hostname'] The hostname of your database server.
|    ['username'] The username used to connect to the database
|    ['password'] The password used to connect to the database
|    ['database'] The name of the database you want to connect to
|    ['dbdriver'] The database type. ie: mysql.  Currently supported:
                 mysql, mysqli, postgre, odbc, mssql, sqlite, oci8
|    ['dbprefix'] You can add an optional prefix, which will be added
|                 to the table name when using the  Active Record class
|    ['pconnect'] TRUE/FALSE - Whether to use a persistent connection
|    ['db_debug'] TRUE/FALSE - Whether database errors should be displayed.
|    ['cache_on'] TRUE/FALSE - Enables/disables query caching
|    ['cachedir'] The path to the folder where cache files should be stored
|    ['char_set'] The character set used in communicating with the database
|    ['dbcollat'] The character collation used in communicating with the database
|    ['swap_pre'] A default table prefix that should be swapped with the dbprefix
|    ['autoinit'] Whether or not to automatically initialize the database.
|    ['stricton'] TRUE/FALSE - forces 'Strict Mode' connections
|                            - good for ensuring strict SQL while developing
|
| The $active_group variable lets you choose which connection group to
| make active.  By default there is only one group (the 'default' group).
|
| The $active_record variables lets you determine whether or not to load
| the active record class
*/

$active_group = 'default';
$active_record = TRUE;

if (!function_exists('pancake_env')) {
	function pancake_env($key, $default = null) {
		$value = getenv($key);
		return $value === false ? $default : $value;
	}
}

if (!function_exists('pancake_env_bool')) {
	function pancake_env_bool($key, $default = false) {
		$value = getenv($key);
		if ($value === false) {
			return $default;
		}

		$filtered = filter_var($value, FILTER_VALIDATE_BOOLEAN, FILTER_NULL_ON_FAILURE);
		return $filtered === null ? $default : $filtered;
	}
}

if (!function_exists('pancake_env_int')) {
	function pancake_env_int($key, $default = null) {
		$value = getenv($key);
		if ($value === false || !is_numeric($value)) {
			return $default;
		}

		return (int) $value;
	}
}

$db['default']['hostname'] = pancake_env('PANCAKE_DB_HOST', 'localhost');
$db['default']['username'] = pancake_env('PANCAKE_DB_USERNAME', 'root');
$db['default']['password'] = pancake_env('PANCAKE_DB_PASSWORD', '3QU5eA&U^Y&3DQm6');
$db['default']['database'] = pancake_env('PANCAKE_DB_NAME', 'pancake');
$db['default']['dbdriver'] = pancake_env('PANCAKE_DB_DRIVER', 'mysqli');
$db['default']['dbprefix'] = pancake_env('PANCAKE_DB_PREFIX', 'pancake_');
$db['default']['pconnect'] = pancake_env_bool('PANCAKE_DB_PCONNECT', FALSE);
$db['default']['db_debug'] = pancake_env_bool('PANCAKE_DB_DEBUG', TRUE);
$db['default']['cache_on'] = pancake_env_bool('PANCAKE_DB_CACHE_ON', FALSE);
$db['default']['cachedir'] = pancake_env('PANCAKE_DB_CACHEDIR', '');
$db['default']['char_set'] = pancake_env('PANCAKE_DB_CHARSET', 'utf8mb4');
$db['default']['dbcollat'] = pancake_env('PANCAKE_DB_COLLATION', 'utf8mb4_general_ci');
$db['default']['swap_pre'] = pancake_env('PANCAKE_DB_SWAP_PRE', '');
$db['default']['autoinit'] = pancake_env_bool('PANCAKE_DB_AUTOINIT', TRUE);
$db['default']['stricton'] = pancake_env_bool('PANCAKE_DB_STRICTON', TRUE);
$db['default']['port']     = pancake_env_int('PANCAKE_DB_PORT', 3306);

/* End of file database.php */
/* Location: ./application/config/database.php */