gameServer/ConfigFile.hs
changeset 4975 31da8979e5b1
parent 4974 078cd026a7b1
child 4982 3572eaf14340
equal deleted inserted replaced
4974:078cd026a7b1 4975:31da8979e5b1
       
     1 {-# LANGUAGE RankNTypes #-}
     1 module ConfigFile where
     2 module ConfigFile where
     2 
     3 
       
     4 import Data.Maybe
     3 import Data.TConfig
     5 import Data.TConfig
       
     6 import qualified Data.ByteString.Char8 as B
     4 -------------------
     7 -------------------
     5 import CoreTypes
     8 import CoreTypes
     6 
     9 
     7 readServerConfig :: ServerInfo -> IO ServerInfo
    10 readServerConfig serverInfo' = do
     8 readServerConfig = undefined
    11     cfg <- readConfig "hedgewars-server.ini"
       
    12     let si = serverInfo'{
       
    13         dbHost = value "dbHost" cfg
       
    14         , dbLogin = value "dbLogin" cfg
       
    15         , dbPassword = value "dbPassword" cfg
       
    16         , serverConfig = Just cfg
       
    17     }
       
    18     return si
       
    19     where
       
    20         value n c = B.pack . fromJust $ getValue n c
     9 
    21 
    10 writeServerConfig :: ServerInfo -> IO
    22 writeServerConfig :: ServerInfo c -> IO ()
    11 writeServerConfig = undefined
    23 writeServerConfig = undefined