Add flag to not require SQL database, update sample env
This commit is contained in:
parent
eddea2c9a1
commit
9839586576
@ -7,7 +7,13 @@
|
|||||||
*/
|
*/
|
||||||
|
|
||||||
$SETTINGS = [
|
$SETTINGS = [
|
||||||
|
// If true, PHP errors and warnings are outputted, screwing up the JSON.
|
||||||
|
// Makes it easy to debug though!
|
||||||
"debugmode" => true,
|
"debugmode" => true,
|
||||||
|
// If this is true and the database isn't configured, everything crashes.
|
||||||
|
// set to false if no endpoints require a database, or if Medoo isn't being used
|
||||||
|
// to access the database.
|
||||||
|
"require_database" => false,
|
||||||
"database" => [
|
"database" => [
|
||||||
"database_type" => "mysql",
|
"database_type" => "mysql",
|
||||||
"database_name" => "mysql",
|
"database_name" => "mysql",
|
||||||
@ -16,6 +22,8 @@ $SETTINGS = [
|
|||||||
"password" => "",
|
"password" => "",
|
||||||
"charset" => "utf8"
|
"charset" => "utf8"
|
||||||
],
|
],
|
||||||
|
// If memcached is available, enable it. Otherwise a non-persistent shim is used,
|
||||||
|
// which is pointless. See lib/Memcache.lib.php.
|
||||||
"memcached" => [
|
"memcached" => [
|
||||||
"enable" => true,
|
"enable" => true,
|
||||||
"server" => "127.0.0.1",
|
"server" => "127.0.0.1",
|
||||||
@ -26,6 +34,8 @@ $SETTINGS = [
|
|||||||
// Include trailing slash
|
// Include trailing slash
|
||||||
"urlbase" => "/",
|
"urlbase" => "/",
|
||||||
|
|
||||||
|
|
||||||
|
// Third party API keys and configs for various endpoints go here
|
||||||
"openweathermap_appid" => "",
|
"openweathermap_appid" => "",
|
||||||
"weather_summary_hours" => 8,
|
"weather_summary_hours" => 8,
|
||||||
|
|
||||||
|
@ -43,12 +43,16 @@ if (envhas("timezone")) {
|
|||||||
|
|
||||||
// Initialize database driver
|
// Initialize database driver
|
||||||
use Medoo\Medoo;
|
use Medoo\Medoo;
|
||||||
|
|
||||||
$database;
|
$database;
|
||||||
try {
|
try {
|
||||||
$database = new Medoo(env("database", []));
|
$database = new Medoo(env("database", []));
|
||||||
} catch (Exception $ex) {
|
} catch (Exception $ex) {
|
||||||
http_response_code(500);
|
if (env("require_database")) {
|
||||||
Logger::log("Database error: $ex");
|
http_response_code(500);
|
||||||
|
Logger::log("Database error: $ex");
|
||||||
|
exit("Database error.");
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
$memcacheconfig = env("memcached", [
|
$memcacheconfig = env("memcached", [
|
||||||
|
Loading…
x
Reference in New Issue
Block a user