]> gitweb @ CieloNegro.org - Rakka.git/blobdiff - Rakka/SystemConfig.hs
Use time-w3c instead of Rakka.W3CDateTime
[Rakka.git] / Rakka / SystemConfig.hs
index aa1e5798d24ee387bac9582797fc97d492d79a17..4978b46d131bc853271438120e860b5ac17f5fdc 100644 (file)
@@ -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) ++ "/"