gameServer/ConfigFile.hs
author unc0rr
Fri, 04 Mar 2011 11:30:53 +0300
changeset 4981 0c60ade27a0a
parent 4975 31da8979e5b1
child 4982 3572eaf14340
permissions -rw-r--r--
Optimize check (not like it is called much, just ffs; not tested)

{-# LANGUAGE RankNTypes #-}
module ConfigFile where

import Data.Maybe
import Data.TConfig
import qualified Data.ByteString.Char8 as B
-------------------
import CoreTypes

readServerConfig serverInfo' = do
    cfg <- readConfig "hedgewars-server.ini"
    let si = serverInfo'{
        dbHost = value "dbHost" cfg
        , dbLogin = value "dbLogin" cfg
        , dbPassword = value "dbPassword" cfg
        , serverConfig = Just cfg
    }
    return si
    where
        value n c = B.pack . fromJust $ getValue n c

writeServerConfig :: ServerInfo c -> IO ()
writeServerConfig = undefined