summaryrefslogblamecommitdiffstats
path: root/config.php.example
blob: ded60bf0e725f7fb2df00c30539b456e661b584d (plain) (tree)
1
2
3
4
5
6
7




                                                                     

                                                               








                                                                                                     
                           







                                                                                                 
            
<?php

// This might leak sensitive information. Never enable in production!
define('CONFIG_DEBUG', true);
define('CONFIG_PREFIX', '/webif/');
define('CONFIG_SESSION_TIMEOUT', 86400 * 7);
define('CONFIG_FORCE_DOMAIN', 'my.server.address.example.com');

// 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];
}
unset($lines, $line, $out);
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);
unset($key);