summaryrefslogtreecommitdiff
path: root/Biz/Devalloc.hs
diff options
context:
space:
mode:
Diffstat (limited to 'Biz/Devalloc.hs')
-rw-r--r--Biz/Devalloc.hs18
1 files changed, 13 insertions, 5 deletions
diff --git a/Biz/Devalloc.hs b/Biz/Devalloc.hs
index 5e23e67..6b17e40 100644
--- a/Biz/Devalloc.hs
+++ b/Biz/Devalloc.hs
@@ -201,13 +201,14 @@ main = Exception.bracket startup shutdown run
jwk <- Auth.generateKey
putText "@"
putText "devalloc"
+ putText <| "area: " <> (show <| area cfg)
putText <| "port: " <> (show <| port cfg)
putText <| "depo: " <> (Text.pack <| depo cfg)
putText <| "keep: " <> (Text.pack <| keep cfg)
let jwtCfg = Auth.defaultJWTSettings jwk
let cooks = case area cfg of
- Test -> devCookieSettings
- Live -> Auth.defaultCookieSettings
+ Test -> liveCookieSettings
+ Live -> liveCookieSettings
let ctx = cooks :. jwtCfg :. EmptyContext
let app = serveWithContext paths ctx (toServant <| htmlApp cooks kp cfg jwk oAuthArgs)
return (cfg, app, kp)
@@ -216,8 +217,16 @@ main = Exception.bracket startup shutdown run
run :: (Config, Wai.Application, Acid.AcidState Keep) -> IO ()
run (cfg, app, _) = Warp.run (port cfg) (logStdout app)
-devCookieSettings :: Auth.CookieSettings
-devCookieSettings =
+liveCookieSettings :: Auth.CookieSettings
+liveCookieSettings =
+ Auth.defaultCookieSettings
+ { Auth.cookieIsSecure = Auth.Secure,
+ -- TODO: fix this, add js snippet
+ Auth.cookieXsrfSetting = Nothing
+ }
+
+testCookieSettings :: Auth.CookieSettings
+testCookieSettings =
Auth.defaultCookieSettings
{ Auth.cookieIsSecure = Auth.NotSecure,
Auth.cookieXsrfSetting = Nothing
@@ -366,7 +375,6 @@ htmlApp cooks kp cfg jwk oAuthArgs =
pure <. HtmlApp <| Home oAuthArgs,
githubAuth =
auth kp cooks jwk oAuthArgs,
- -- TODO: guard on (AuthResult)
selectRepo = \case
Auth.NoSuchUser -> throwError err401 {errBody = "No such user"}
Auth.BadPassword -> throwError err401 {errBody = "Bad password"}