blob: 9197d97183b497810907af44947e1765b250be10 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
|
module Uplcg.Config
( Config (..)
, fromEnv
) where
import qualified Data.Text as T
import System.Environment (getEnv)
import Uplcg.BaseUrl (BaseUrl)
import qualified Uplcg.BaseUrl as BaseUrl
data Config = Config
{ cHostname :: String
, cPort :: Int
, cBaseUrl :: BaseUrl
} deriving (Show)
fromEnv :: IO Config
fromEnv = Config
<$> getEnv "UPLCG_HOSTNAME"
<*> (read <$> getEnv "UPLCG_PORT")
<*> (BaseUrl.parse . T.pack <$> getEnv "UPLCG_BASE")
|