blob: 3a9decf39c192b4177d3fb1be0c9ff01ec57e941 (
plain) (
blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
|
--------------------------------------------------------------------------------
module Types where
--------------------------------------------------------------------------------
import RIO
import Data.Aeson
import System.Envy (FromEnv, fromEnv, env)
--------------------------------------------------------------------------------
-- | Read from .envrc
data Env = Env
{ envGoogleClientID :: !String
} deriving (Eq, Show)
instance FromEnv Env where
fromEnv _ = do
envGoogleClientID <- env "GOOGLE_CLIENT_ID"
pure Env {..}
-- | Application context: a combination of Env and additional values.
data Context = Context
{ contextGoogleClientID :: !String
, contextServerPort :: !Int
, contextClientPort :: !Int
}
data VerifyGoogleSignInRequest = VerifyGoogleSignInRequest
{ idToken :: !Text
} deriving (Eq, Show)
instance FromJSON VerifyGoogleSignInRequest where
parseJSON = withObject "" $ \x -> do
idToken <- x .: "idToken"
pure VerifyGoogleSignInRequest{..}
|