Add YORE_STATIC_DIR for wiring static directory

This commit is contained in:
Paul Brinkmeier 2026-05-17 20:21:11 +02:00
parent 799cd1c938
commit de11a86285
2 changed files with 4 additions and 2 deletions

View File

@ -73,6 +73,7 @@ data ConfigT f = Config
{ yorePort :: f =@@ Int ? 3000 { yorePort :: f =@@ Int ? 3000
, yoreDownloadDir :: f =@@ FilePath ? "./download" , yoreDownloadDir :: f =@@ FilePath ? "./download"
, yoreDb :: f =@! Text , yoreDb :: f =@! Text
, yoreStaticDir :: f =@@ FilePath ? "./static"
} }
deriving (Generic) deriving (Generic)
@ -206,7 +207,7 @@ server cfg db = rootR :<|> todayR :<|> staticR :<|> apiTodayR
dayFile <- DB.withConn db $ DB.getDayFileByIssue dateThen issue dayFile <- DB.withConn db $ DB.getDayFileByIssue dateThen issue
pure $ RootModel dateThen dayFile issue count pure $ RootModel dateThen dayFile issue count
staticR = serveDirectoryWebApp "static" staticR = serveDirectoryWebApp cfg.yoreStaticDir
apiTodayR issue = do apiTodayR issue = do
dateThen <- getTodayWithOffset (-100) 0 dateThen <- getTodayWithOffset (-100) 0

View File

@ -85,7 +85,8 @@
chmod +w -R "''${TMPDIR}" chmod +w -R "''${TMPDIR}"
rm -rf "''${TMPDIR}" rm -rf "''${TMPDIR}"
cp -r ${./static} static echo ${./static}
export YORE_STATIC_DIR=${./static}
# Replace bash and inherit PID 1 # Replace bash and inherit PID 1
cd / cd /