]> gitweb.michael.orlitzky.com - dead/harbl.git/blobdiff - harbl-cli/src/Configuration.hs
Clean up the configurator code in the CLI app.
[dead/harbl.git] / harbl-cli / src / Configuration.hs
index 64adc7e6a7bb330b396cf0603b3381f61e49edca..a6798e97f08f38803edb0116a2f5080bffae5465 100644 (file)
@@ -7,8 +7,12 @@ module Configuration (
   merge_optional )
 where
 
+import Data.Monoid ( Monoid(..) )
 import System.Console.CmdArgs.Default ( Default(..) )
 
+-- From the harbl library.
+import Network.DNS.RBL.Weight ( Weight )
+
 import qualified OptionalConfiguration as OC (
   OptionalConfiguration(..) )
 import Hosts ( Hosts(..) )
@@ -22,6 +26,7 @@ data Configuration =
   Configuration {
     hosts  :: Hosts,
     lists  :: Lists }
+--    threshold :: Weight }
     deriving (Show)
 
 
@@ -29,7 +34,9 @@ data Configuration =
 --   values.
 --
 instance Default Configuration where
-  def = Configuration { hosts = def, lists = def }
+  def = Configuration { hosts = def,
+                        lists = def }
+--                        threshold = def }
 
 
 -- | Merge a 'Configuration' with an 'OptionalConfiguration'. This is
@@ -42,7 +49,5 @@ merge_optional :: Configuration
 merge_optional cfg opt_cfg =
   Configuration all_hosts all_lists
   where
-    all_hosts =
-      Hosts $ (get_hosts $ hosts cfg) ++ (get_hosts $ OC.hosts opt_cfg)
-    all_lists =
-      Lists $ (get_lists $ lists cfg) ++ (get_lists $ OC.lists opt_cfg)
+    all_hosts = (hosts cfg) `mappend` (OC.hosts opt_cfg)
+    all_lists = (lists cfg) `mappend` (OC.lists opt_cfg)