Added base_uri to config classes

This commit is contained in:
ByteHamster 2020-06-08 22:44:49 +02:00
parent 74c426e83d
commit 244b6eca24
3 changed files with 8 additions and 9 deletions

View file

@ -65,8 +65,9 @@ class Standard extends \Baikal\Model\Config {
"cal_enabled" => true,
"dav_auth_type" => "Digest",
"admin_passwordhash" => "",
"auth_realm" => "BaikalDAV"
];
"auth_realm" => "BaikalDAV",
"base_uri" => ""
];
function __construct() {
$this->aData["invite_from"] = "noreply@" . $_SERVER['SERVER_NAME']; // Default value

View file

@ -204,24 +204,21 @@ class Framework extends \Flake\Core\Framework {
}
protected static function defineBaseUri() {
$usedBaseUriFromConfig = false;
try {
$config = Yaml::parseFile(PROJECT_PATH_CONFIG . "baikal.yaml");
if (isset($config["system"]["base_uri"]) && $config["system"]["base_uri"] !== "") {
// SabreDAV needs a "/" at the beginning of BASEURL
define("PROJECT_BASEURI", self::prependSlash($config["system"]["base_uri"]));
define("PROJECT_BASEURI",
self::prependSlash(self::appendSlash($config["system"]["base_uri"])));
define("PROJECT_URI", \Flake\Util\Tools::getCurrentProtocol() . "://"
. $_SERVER["HTTP_HOST"] . PROJECT_BASEURI);
$usedBaseUriFromConfig = true;
return;
}
} catch (\Exception $e) {
error_log($e);
}
if ($usedBaseUriFromConfig) {
return;
}
$sScript = substr($_SERVER["SCRIPT_FILENAME"], strlen($_SERVER["DOCUMENT_ROOT"]));
$sDirName = str_replace("\\", "/", dirname($sScript)); // fix windows backslashes

View file

@ -7,6 +7,7 @@ system:
dav_auth_type: 'Digest'
admin_passwordhash: 5fe794627e1f841f8debba065e2c807a
auth_realm: BaikalDAV
base_uri: ''
database:
encryption_key: 5d3f0fa0192e3058ea70f1bb20924add
sqlite_file: "absolute/path/to/Specific/db/db.sqlite"