aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--src/Config.hs16
-rw-r--r--src/Main.hs14
2 files changed, 21 insertions, 9 deletions
diff --git a/src/Config.hs b/src/Config.hs
index 535f3e8..dcb6427 100644
--- a/src/Config.hs
+++ b/src/Config.hs
@@ -31,7 +31,8 @@ data Config = Config {
confUser :: Text,
confPwHash :: Text,
confEmailCmd :: Maybe FilePath,
- confAdminEmail :: String
+ confAdminEmail :: String,
+ confNoEmbed :: Bool
} deriving (Show, Eq)
getConfig :: IO Config
@@ -42,13 +43,14 @@ getConfig = do
Config
<$> (read <$> resolveVal (lookup "port" confFile) "PORT" "20546")
- <*> resolveVal (lookup "bind-addr" confFile) "BIND_ADDR" "*6"
- <*> resolveVal (lookup "base-url" confFile) "BASE_URL" "http://localhost:20546"
- <*> resolveVal (lookup "favicon-url" confFile) "FAVICON_URL" ""
- <*> resolveVal (lookup "admin-user" confFile) "ADMIN_USER" "bleb"
- <*> resolveVal (lookup "admin-pw-hash" confFile) "ADMIN_PW_HASH" "" -- prevent login without manual pw
+ <*> resolveVal (lookup "bind-addr" confFile) "BIND_ADDR" "*6"
+ <*> resolveVal (lookup "base-url" confFile) "BASE_URL" "http://localhost:20546"
+ <*> resolveVal (lookup "favicon-url" confFile) "FAVICON_URL" ""
+ <*> resolveVal (lookup "admin-user" confFile) "ADMIN_USER" "bleb"
+ <*> resolveVal (lookup "admin-pw-hash" confFile) "ADMIN_PW_HASH" "" -- prevent login without manual pw
<*> fmap (<|> lookup "email-command" confFile) (lookupEnv "EMAIL_CMD")
- <*> resolveVal (lookup "admin-email" confFile) "ADMIN_EMAIL" ""
+ <*> resolveVal (lookup "admin-email" confFile) "ADMIN_EMAIL" ""
+ <*> fmap read (resolveVal (lookup "debug-no-embed" confFile) "DEBUG_NO_EMBED" "False")
where resolveVal :: IsString s => Maybe String -> String -> String -> IO s
resolveVal mayConf q def = do
diff --git a/src/Main.hs b/src/Main.hs
index 03709d4..a59b38a 100644
--- a/src/Main.hs
+++ b/src/Main.hs
@@ -62,12 +62,22 @@ getHomeR = do
getBundleR :: Handler TypedContent
getBundleR = do
cacheSeconds $ 60 * 60 * 24 * 7
- return $ TypedContent typeJavascript $ toContent ($(embedFile "build/bundle.js"))
+ noEmbed <- confNoEmbed . config <$> getYesod
+ bundle <- liftIO $ bool
+ (pure $ toContent ($(embedFile "build/bundle.js")))
+ (toContent <$> readFile "../build/bundle.js")
+ noEmbed
+ return $ TypedContent typeJavascript bundle
getStyleR :: Handler TypedContent
getStyleR = do
cacheSeconds $ 60 * 60 * 24 * 7
- return $ TypedContent typeCss $ toContent ($(embedFile "build/style.css"))
+ noEmbed <- confNoEmbed . config <$> getYesod
+ stylesheet <- liftIO $ bool
+ (pure $ toContent ($(embedFile "build/style.css")))
+ (toContent <$> readFile "../build/style.css")
+ noEmbed
+ return $ TypedContent typeCss stylesheet
getBangsR :: Handler TypedContent
getBangsR = do