summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--Com/InfluencedByBooks/Apex.hs17
1 files changed, 10 insertions, 7 deletions
diff --git a/Com/InfluencedByBooks/Apex.hs b/Com/InfluencedByBooks/Apex.hs
index c154f95..20b4e65 100644
--- a/Com/InfluencedByBooks/Apex.hs
+++ b/Com/InfluencedByBooks/Apex.hs
@@ -37,12 +37,14 @@ import System.Environment (lookupEnv)
main :: IO ()
main = do
say "rise: ibb"
+ staticDir <- fromMaybe "static"
+ <$> lookupEnv "STATIC_DIR" :: IO [Char]
port <- read
- <$> fromMaybe "3000"
- <$> lookupEnv "PORT" :: IO Int
+ <$> fromMaybe "3000"
+ <$> lookupEnv "PORT" :: IO Int
keep <- Keep.openLocal "keep/"
say "port: 3000"
- run port $ logStdout $ compress $ app $ keep
+ run port $ logStdout $ compress $ app staticDir $ keep
where
compress = gzip def { gzipFiles = GzipCompress }
@@ -55,7 +57,7 @@ instance L.ToHtml a => L.ToHtml (HtmlPage a) where
L.doctypehtml_ $ do
L.head_ $ do
L.meta_ [L.charset_ "utf-8"]
- jsRef "/static/all.js"
+ jsRef "/static/ibb.js"
cssRef "/css/main.css"
L.body_ $ do
page
@@ -102,8 +104,8 @@ cssHandlers :: Server CssRoute
cssHandlers = return . Lazy.toStrict . Clay.render
$ Look.main
-app :: AcidState Keep.IbbKeep -> Application
-app keep = serve
+app :: [Char] -> AcidState Keep.IbbKeep -> Application
+app staticDir keep = serve
(Proxy @Routes)
$ static
:<|> cssHandlers
@@ -111,7 +113,8 @@ app keep = serve
:<|> apiHandlers keep
:<|> Tagged handle404
where
- static = serveDirectoryWith (defaultWebAppSettings "ibb.jsexe")
+ static = serveDirectoryWith
+ (defaultWebAppSettings $ staticDir)
type ApiRoutes =
"people" :> Get '[JSON] [Person]