Fix Baikal build

Signed-off-by: main <magic_rb@redalder.org>
This commit is contained in:
main 2022-07-31 07:45:50 +02:00
parent 1de865fe93
commit 051a7da66a
No known key found for this signature in database
GPG key ID: 08D5287CC5DDCA0E
2 changed files with 71 additions and 53 deletions

View file

@ -19,12 +19,15 @@ nglib.makeSystem {
baikal =
pkgs.fetchzip {
url = "https://github.com/sabre-io/Baikal/releases/download/0.9.2/baikal-0.9.2.zip";
sha256 = "sha256-xOxO7Ppuw+d8KUJWAM9SNl/U0pezzWvY8bpTvFQrZN0=";
sha256 = "sha256-/LdwMVy0aGaj2B5db107duYl7oKcA/BuMXt/zZxlsZw=";
extraPostFetch = ''
patch -p1 -d "$out" < ${./baikal/baikal-project-uri.patch}
'';
};
in
pkgs.writeShellScript "baikal-script"
''
set -e
set -ex
mkdir -p /var/www
if ! [ -z "$(ls -A /var/www)" ] ; then
rm -r /var/www/*
@ -117,6 +120,7 @@ nglib.makeSystem {
[ "authn_dbd_module" "modules/mod_authn_dbd.so" ]
[ "authz_user_module" "modules/mod_authz_user.so" ]
[ "authz_host_module" "modules/mod_authz_host.so" ]
[ "headers_module" "modules/mod_headers.so" ]
];
}
{
@ -149,27 +153,22 @@ nglib.makeSystem {
}
{
Directory = {
"/" = {
Directory."/" = {
Require = [ "all" "denied" ];
Options = "SymlinksIfOwnerMatch";
};
};
VirtualHost = {
"*:80" = {
DocumentRoot = "/var/www/html/";
RewriteEngine = "on";
VirtualHost."*:80" = {
DocumentRoot = "/var/www/";
RewriteEngine = "off";
LogLevel = [ "alert" "rewrite:trace3" ];
RewriteRule =
[ [ "/.well-known/carddav" "/dav.php" "[R=308,L]" ]
[ "/.well-known/caldav" "/dav.php" "[R=308,L]" ]
# [ "^/baikal/(.*)\.php$" "unix:${config.services.php-fpm.pools.main.socket}|fcgi:///var/www/html/$0" ]
# [ "^/dav(.*)$" "/webdav/%{LA-U:REMOTE_USER}" "" ]
];
ProxyPassMatch =
[
"^/(.*\.php(/.*)?)$"
"unix:${config.services.php-fpm.pools.main.socket}|fcgi://./var/www/html/"
# [ "^/baikal(.*)$" "/var/www/html/$1" "" ]
];
# DBDriver = "sqlite3";
@ -180,16 +179,23 @@ nglib.makeSystem {
# DBDMax = 20;
# DBDExptime = 300;
# Alias =
# [ [ "/webdav" "/var/webdav" ]
# ];
# Location."/var/www/html/baikal" = {
# Require = [ "all" "granted" ];
# AllowOverride = [ "all" ];
# Options = [ "-Indexes" "+FollowSymlinks" ];
# DirectoryIndex = "index.php";
# RewriteRule = [ "^/baikal/(.*)$" "/" ];
# };
Directory = {
"/var/www/html" = {
Location."/var/www/html/" = {
Header =
[ [ "set" "X-Baikal-Uri" "http://localhost:8088/baikal" ]
[ "set" "Host" "http://localhost:8088/baikal" ]
];
Options = [ "-Indexes" "+FollowSymlinks" ];
Require = [ "all" "granted" ];
AllowOverride = [ "all" ];
Options = [ "-Indexes" "+FollowSymlinks" ];
DirectoryIndex = "index.php";
# ProxyPass = [ "unix:${config.services.php-fpm.pools.main.socket}|fcgi:///var/www/html/" ];
};
# "/var/webdav" = {
@ -207,8 +213,6 @@ nglib.makeSystem {
# AllowOverride = [ "all" ];
# };
};
};
};
}
];
};

View file

@ -0,0 +1,14 @@
diff --git a/Core/Frameworks/Flake/Framework.php b/Core/Frameworks/Flake/Framework.php
index 73f6b9d..139ee75 100644
--- a/Core/Frameworks/Flake/Framework.php
+++ b/Core/Frameworks/Flake/Framework.php
@@ -239,7 +239,8 @@ class Framework extends \Flake\Core\Framework {
$sHttpBaseUrl = self::rmQuery($sHttpBaseUrl);
$sHttpBaseUrl = self::rmScriptName($sHttpBaseUrl, $sScript);
$sHttpBaseUrl = self::rmProjectContext($sHttpBaseUrl);
- define("PROJECT_URI", $sProtocol . "://" . $_SERVER["HTTP_HOST"] . $sHttpBaseUrl);
+ define("PROJECT_URI", $_SERVER['HTTP_X_BAIKAL_URI']);
+ echo $PROJECT_URI
unset($sScript);
unset($sDirName);
unset($sBaseUrl);