summaryrefslogblamecommitdiffstats
path: root/config.php.example
blob: f3a9cf24ae9faaf57ba3874506400cfcc6187da7 (plain) (tree)























                                                                                                     
<?php

// This might leak sensitive information. Never enable in production!
define('CONFIG_DEBUG', true);
define('CONFIG_PREFIX', '/webif/');

// Have a properties file or set variables here manually.
// Make sure properties file is not in webroot
$lines = @file('/some/where/config/mysql.properties', FILE_IGNORE_NEW_LINES | FILE_SKIP_EMPTY_LINES);
$key = array();
foreach ($lines as $line) {
	if (preg_match('/^\s*(.+?)\s*=\s*(\S*)\s*$/', $line, $out))
		$key[$out[1]] = $out[2];
}

if (empty($key['host']) || empty($key['db']) || empty($key['user']) || empty($key['password'])) {
	die('Missing database config');
}

define('CONFIG_SQL_DSN', "mysql:dbname={$key['db']};host={$key['host']}");
define('CONFIG_SQL_USER', $key['user']);
define('CONFIG_SQL_PASS', $key['password']);
define('CONFIG_SQL_FORCE_UTF8', true);