summaryrefslogtreecommitdiffstats
path: root/config.php.example
diff options
context:
space:
mode:
authorSimon Rettberg2015-03-02 16:51:04 +0100
committerSimon Rettberg2015-03-02 16:51:04 +0100
commitab23338fe9f1b3ed21455867f1c032d7b146ceb8 (patch)
tree33d27fd848e25ae24a57b309348b5d73a811f223 /config.php.example
downloadbwlp-webadmin-ab23338fe9f1b3ed21455867f1c032d7b146ceb8.tar.gz
bwlp-webadmin-ab23338fe9f1b3ed21455867f1c032d7b146ceb8.tar.xz
bwlp-webadmin-ab23338fe9f1b3ed21455867f1c032d7b146ceb8.zip
Initial Commit
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);
+