23 lines
675 B
Haskell
23 lines
675 B
Haskell
{-# Language TypeApplications #-}
|
|
|
|
module Main (main) where
|
|
|
|
import UniWorX
|
|
import Server
|
|
import Control.Applicative ((<|>))
|
|
import System.Environment (lookupEnv)
|
|
import qualified Data.Map as M
|
|
import qualified Data.Text as T
|
|
|
|
main :: IO ()
|
|
main = do
|
|
port <- determinePort
|
|
putStrLn $ "Try: http://localhost:" ++ show port ++ "/auth?scope=ID%20Profile&client_id=42&response_type=code&redirect_uri=http:%2F%2Flocalhost:0000%2F"
|
|
initDB
|
|
runMockServer @User @(M.Map T.Text T.Text) port
|
|
where
|
|
determinePort :: IO Int
|
|
determinePort = do
|
|
Just port <- lookupEnv "OAUTH2_SERVER_PORT" >>= \p -> return $ p <|> Just "9443"
|
|
return $ read @Int port
|