From 9f2d12f0b098a365d7b0d4cc00b03fd2e5284740 Mon Sep 17 00:00:00 2001 From: Jasper Van der Jeugt Date: Sun, 16 Aug 2020 10:21:14 +0200 Subject: WIP --- server/lib/Uplcg/Config.hs | 24 ++++++++++++++++++++++++ 1 file changed, 24 insertions(+) create mode 100644 server/lib/Uplcg/Config.hs (limited to 'server/lib/Uplcg/Config.hs') diff --git a/server/lib/Uplcg/Config.hs b/server/lib/Uplcg/Config.hs new file mode 100644 index 0000000..627a829 --- /dev/null +++ b/server/lib/Uplcg/Config.hs @@ -0,0 +1,24 @@ +module Uplcg.Config + ( Config (..) + , fromEnv + ) where + +import Data.String (fromString) +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 + , cVersion :: String + } deriving (Show) + +fromEnv :: IO Config +fromEnv = Config + <$> getEnv "UPLCG_HOSTNAME" + <*> (read <$> getEnv "UPLCG_PORT") + <*> (BaseUrl.parse . T.pack <$> getEnv "UPLCG_BASE") + <*> getEnv "UPLCG_VERSION" -- cgit v1.2.3 From 5a3fc14c1a92b28423d1b64b64e12d0502a90219 Mon Sep 17 00:00:00 2001 From: Jasper Van der Jeugt Date: Sun, 16 Aug 2020 12:29:31 +0200 Subject: Move client to server --- server/lib/Uplcg/Config.hs | 3 --- 1 file changed, 3 deletions(-) (limited to 'server/lib/Uplcg/Config.hs') diff --git a/server/lib/Uplcg/Config.hs b/server/lib/Uplcg/Config.hs index 627a829..9197d97 100644 --- a/server/lib/Uplcg/Config.hs +++ b/server/lib/Uplcg/Config.hs @@ -3,7 +3,6 @@ module Uplcg.Config , fromEnv ) where -import Data.String (fromString) import qualified Data.Text as T import System.Environment (getEnv) import Uplcg.BaseUrl (BaseUrl) @@ -13,7 +12,6 @@ data Config = Config { cHostname :: String , cPort :: Int , cBaseUrl :: BaseUrl - , cVersion :: String } deriving (Show) fromEnv :: IO Config @@ -21,4 +19,3 @@ fromEnv = Config <$> getEnv "UPLCG_HOSTNAME" <*> (read <$> getEnv "UPLCG_PORT") <*> (BaseUrl.parse . T.pack <$> getEnv "UPLCG_BASE") - <*> getEnv "UPLCG_VERSION" -- cgit v1.2.3