diff options
author | Ben Sima <ben@bsima.me> | 2023-01-09 13:06:53 -0500 |
---|---|---|
committer | Ben Sima <ben@bsima.me> | 2023-01-09 13:06:53 -0500 |
commit | 906db8d4ac24f65f38e1d31bfdaa47602a54d759 (patch) | |
tree | 6f17a84703fb12599d393dc58a90ba9e62f5ca97 /Biz/Dragons.hs | |
parent | 3e89ecfeb236065d845a632324324d57c49b829e (diff) |
Reorganize some Auth/App stuff
Diffstat (limited to 'Biz/Dragons.hs')
-rw-r--r-- | Biz/Dragons.hs | 32 |
1 files changed, 4 insertions, 28 deletions
diff --git a/Biz/Dragons.hs b/Biz/Dragons.hs index 7307f69..d71ca3c 100644 --- a/Biz/Dragons.hs +++ b/Biz/Dragons.hs @@ -749,8 +749,8 @@ startup quiet = do Log.info ["boot", "home", "example", url] >> Log.br let jwtCfg = Auth.defaultJWTSettings jwk let cooks = case area cfg of - Test -> testCookieSettings - Live -> liveCookieSettings + App.Test -> Auth.testCookieSettings + App.Live -> Auth.liveCookieSettings let ctx = cooks :. jwtCfg :. EmptyContext let app = serveWithContext paths ctx (toServant <| htmlApp jwtCfg cooks kp cfg oAuthArgs) unless quiet <| do Log.info ["boot", "ready"] >> Log.br @@ -765,21 +765,6 @@ tidy Config {..} = Directory.removeDirectoryRecursive keep run :: (Config, Wai.Application, Acid.AcidState Keep) -> IO () run (cfg, app, _) = Warp.run (port cfg) (Log.wai app) -liveCookieSettings :: Auth.CookieSettings -liveCookieSettings = - Auth.defaultCookieSettings - { Auth.cookieIsSecure = Auth.Secure, - -- disable XSRF protection because we don't use any javascript - Auth.cookieXsrfSetting = Nothing - } - -testCookieSettings :: Auth.CookieSettings -testCookieSettings = - Auth.defaultCookieSettings - { Auth.cookieIsSecure = Auth.NotSecure, - Auth.cookieXsrfSetting = Nothing - } - test :: Test.Tree test = Test.group @@ -797,21 +782,12 @@ test = -- * app configurations -data Area = Test | Live - deriving (Generic, Show) - -instance Envy.Var Area where - toVar = show - fromVar "Test" = Just Test - fromVar "Live" = Just Live - fromVar _ = Just Test - data Config = Config { port :: Warp.Port, -- | The repo depo! Depository of repositories! depo :: FilePath, keep :: FilePath, - area :: Area, + area :: App.Area, -- | A user token for the GitHub API to be used in testing and when getting -- the homepage/example analyses. Get a token with 'repo' scope from GitHub -- and set in .envrc.local @@ -828,7 +804,7 @@ instance Envy.DefConfig Config where { port = 8005, depo = "_/var/dragons/depo", keep = "_/var/dragons/keep", - area = Test, + area = App.Test, tokn = mempty, homeExample = ForgeURL "https://github.com/github/training-kit" } |