summaryrefslogtreecommitdiffstats
path: root/config.php.example
diff options
context:
space:
mode:
Diffstat (limited to 'config.php.example')
-rw-r--r--config.php.example24
1 files changed, 24 insertions, 0 deletions
diff --git a/config.php.example b/config.php.example
new file mode 100644
index 0000000..f3a9cf2
--- /dev/null
+++ b/config.php.example
@@ -0,0 +1,24 @@
+<?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);
+