Installation fixed, version bump 2.4.0
This commit is contained in:
@@ -90,7 +90,7 @@ class Configuration {
|
||||
}
|
||||
|
||||
public function delete(string $className): bool {
|
||||
$path = getClassPath("\\Configuration\\$className");
|
||||
$path = getClassPath($className);
|
||||
if (file_exists($path)) {
|
||||
return unlink($path);
|
||||
}
|
||||
|
||||
@@ -20,8 +20,10 @@ class CreateDatabase extends DatabaseScript {
|
||||
->addBool("private", false) // these values are not returned from '/api/settings/get', but can be changed
|
||||
->addBool("readonly", false) // these values are neither returned, nor can be changed from outside
|
||||
->primaryKey("name");
|
||||
$settingsQuery = $sql->insert("Settings", array("name", "value", "private", "readonly"));
|
||||
(Settings::loadDefaults())->addRows($settingsQuery);
|
||||
|
||||
$defaultSettings = Settings::loadDefaults(loadEnv());
|
||||
$settingsQuery = $sql->insert("Settings", ["name", "value", "private", "readonly"]);
|
||||
$defaultSettings->addRows($settingsQuery);
|
||||
$queries[] = $settingsQuery;
|
||||
|
||||
$queries[] = $sql->createTable("ApiPermission")
|
||||
|
||||
@@ -94,7 +94,7 @@ class Settings {
|
||||
return $this->installationComplete;
|
||||
}
|
||||
|
||||
public static function loadDefaults(): Settings {
|
||||
public static function loadDefaults(?array $env = null): Settings {
|
||||
$protocol = getProtocol();
|
||||
$hostname = getCurrentHostName();
|
||||
$settings = new Settings();
|
||||
@@ -125,6 +125,9 @@ class Settings {
|
||||
if (isDocker()) {
|
||||
$settings->rateLimitingEnabled = true;
|
||||
$settings->redisHost = "webbase-redis";
|
||||
if ($env && array_key_exists("REDIS_PASSWORD", $env)) {
|
||||
$settings->redisPassword = $env["REDIS_PASSWORD"];
|
||||
}
|
||||
} else {
|
||||
$settings->rateLimitingEnabled = false;
|
||||
$settings->redisHost = "";
|
||||
@@ -180,9 +183,9 @@ class Settings {
|
||||
->addRow("mail_username", '""', false, false)
|
||||
->addRow("mail_password", '""', true, false)
|
||||
->addRow("mail_from", '""', false, false)
|
||||
->addRow("mail_footer", '""', false, false)
|
||||
->addRow("mail_footer", '""', false, false)
|
||||
->addRow("mail_async", false, false, false)
|
||||
->addRow("rate_limiting_enabled", json_encode($this->allowedExtensions), false, false)
|
||||
->addRow("rate_limiting_enabled", true, false, false)
|
||||
->addRow("redis_host", json_encode($this->redisHost), false, false)
|
||||
->addRow("redis_port", json_encode($this->redisPort), false, false)
|
||||
->addRow("redis_password", json_encode($this->redisPassword), true, false)
|
||||
|
||||
Reference in New Issue
Block a user