summaryrefslogtreecommitdiff
path: root/Biz/Dragons.hs
diff options
context:
space:
mode:
Diffstat (limited to 'Biz/Dragons.hs')
-rw-r--r--Biz/Dragons.hs32
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"
}