From daba74c8bc066c29eb3488246835f765c111b0c7 Mon Sep 17 00:00:00 2001 From: Daniel Schadt Date: Mon, 19 Jul 2021 22:09:02 +0200 Subject: Add XML config option for sfDoIndices A static file handler that lists directory contents can be set up as follows now: An argument could be made to have it as an attribute instead (<... indices="true" />), but we will have to see how this works out. --- src/Cana/Server.hs | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) (limited to 'src') diff --git a/src/Cana/Server.hs b/src/Cana/Server.hs index 766a371..130de47 100644 --- a/src/Cana/Server.hs +++ b/src/Cana/Server.hs @@ -132,7 +132,11 @@ parseConfig input = case parse input of "staticfiles" -> do path <- unwrapMaybe "No path for static files given" . lookup "path" $ attributes elem - return . staticFiles $ UTF8.toString path + let doIndices = any ((== "indices") . name) $ children elem + return . staticFiles' $ def + { sfBasePath = UTF8.toString path + , sfDoIndices = doIndices + } "runcgi" -> do script <- unwrapMaybe "No script for CGI handler given" . -- cgit v1.2.3