X-Git-Url: http://git.cielonegro.org/gitweb.cgi?p=Rakka.git;a=blobdiff_plain;f=Rakka%2FSystemConfig.hs;h=4978b46d131bc853271438120e860b5ac17f5fdc;hp=aa1e5798d24ee387bac9582797fc97d492d79a17;hb=223d4df57fa1371945075d4d2714e5f36c1fc5dd;hpb=e3e30c2bfa341cef11754e3f4d90b03844ef74d1 diff --git a/Rakka/SystemConfig.hs b/Rakka/SystemConfig.hs index aa1e579..4978b46 100644 --- a/Rakka/SystemConfig.hs +++ b/Rakka/SystemConfig.hs @@ -34,7 +34,7 @@ import Data.Map (Map) import qualified Data.Map as M import Data.Maybe import GHC.Conc (unsafeIOToSTM) -import Network +import Network.BSD import qualified Network.HTTP.Lucu.Config as LC import Network.HTTP.Lucu.Utils import Network.HTTP.Lucu hiding (Config) @@ -48,6 +48,7 @@ import Subversion.FileSystem.Transaction import Subversion.Repository import Subversion.Types import System.FilePath.Posix +import System.IO.Unsafe import System.Log.Logger @@ -225,11 +226,14 @@ instance SysConfValue BaseURI where defaultValue sc = let conf = scLucuConf sc host = C8.unpack $ LC.cnfServerHost conf - port = case LC.cnfServerPort conf of - PortNumber num -> fromIntegral num :: Int - _ -> undefined + port = unsafePerformIO $ + do ent <- getServiceByName (LC.cnfServerPort conf) "tcp" + return (servicePort ent) + -- FIXME: There should be a way to change configurations + -- without web interface nor direct repository + -- modification. defaultURI - = "http://" ++ host ++ -- FIXME: consider IPv6 address + = "http://" ++ host ++ (if port == 80 then "" else ':' : show port) ++ "/"