aboutsummaryrefslogtreecommitdiff
path: root/src/server/Config.hs
diff options
context:
space:
mode:
authorJoris2016-03-20 22:38:44 +0100
committerJoris2016-03-21 20:43:55 +0100
commit1c7d6ea6e3bcd3c672cb5eb3cf22ffc88cabb257 (patch)
tree4ff8aeb6aa0f159548f8f506374276c1a2c97f7d /src/server/Config.hs
parent47104f0b3965cd1dfba0f466afdb5e8983dc7bec (diff)
downloadbudget-1c7d6ea6e3bcd3c672cb5eb3cf22ffc88cabb257.tar.gz
budget-1c7d6ea6e3bcd3c672cb5eb3cf22ffc88cabb257.tar.bz2
budget-1c7d6ea6e3bcd3c672cb5eb3cf22ffc88cabb257.zip
use config-manager instead of ConfigFile
Diffstat (limited to 'src/server/Config.hs')
-rw-r--r--src/server/Config.hs34
1 files changed, 0 insertions, 34 deletions
diff --git a/src/server/Config.hs b/src/server/Config.hs
deleted file mode 100644
index bd7f325..0000000
--- a/src/server/Config.hs
+++ /dev/null
@@ -1,34 +0,0 @@
-{-# LANGUAGE OverloadedStrings #-}
-{-# LANGUAGE FlexibleContexts #-}
-
-module Config
- ( getConfig
- , Config(..)
- ) where
-
-import Data.ConfigFile
-import Data.Text (Text)
-import qualified Data.Text as T
-
-import Control.Monad.Trans.Error (runErrorT)
-import Control.Monad.IO.Class (liftIO)
-import Control.Monad (join)
-import Control.Arrow (left)
-
-data Config = Config
- { hostname :: Text
- , port :: Int
- , signInExpirationMn :: Int
- , currency :: Text
- } deriving (Read, Eq, Show)
-
-getConfig :: FilePath -> IO (Either Text Config)
-getConfig filePath =
- left (T.pack . show) <$> (runErrorT $ do
- cp <- join $ liftIO $ readfile emptyCP filePath
- Config <$>
- (T.pack <$> get cp "DEFAULT" "hostname") <*>
- (get cp "DEFAULT" "port") <*>
- (get cp "DEFAULT" "sign-in-expiration-mn") <*>
- (T.pack <$> get cp "DEFAULT" "currency")
- )