equal
deleted
inserted
replaced
|
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 |