diff options
author | Daniel Schadt <kingdread@gmx.de> | 2021-07-19 22:09:02 +0200 |
---|---|---|
committer | Daniel Schadt <kingdread@gmx.de> | 2021-07-19 22:09:02 +0200 |
commit | daba74c8bc066c29eb3488246835f765c111b0c7 (patch) | |
tree | 4fdcfe0a06c796cf42a59d8daa048c46a286ad65 | |
parent | 699e7ddb239407704a2adee7b4fb8a6c0eb04c8b (diff) | |
download | Cana-daba74c8bc066c29eb3488246835f765c111b0c7.tar.gz Cana-daba74c8bc066c29eb3488246835f765c111b0c7.tar.bz2 Cana-daba74c8bc066c29eb3488246835f765c111b0c7.zip |
Add XML config option for sfDoIndices
A static file handler that lists directory contents can be set up as
follows now:
<staticfiles path="gmdocs">
<indices />
</staticfiles>
An argument could be made to have it as an attribute instead (<...
indices="true" />), but we will have to see how this works out.
-rw-r--r-- | src/Cana/Server.hs | 6 |
1 files changed, 5 insertions, 1 deletions
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" . |