diff options
-rw-r--r-- | Data/ConfigManager.hs | 9 | ||||
-rw-r--r-- | README.md | 2 |
2 files changed, 10 insertions, 1 deletions
diff --git a/Data/ConfigManager.hs b/Data/ConfigManager.hs index a13457c..02c3469 100644 --- a/Data/ConfigManager.hs +++ b/Data/ConfigManager.hs @@ -83,8 +83,11 @@ lookupDefault defaultValue name config = foldl (flip const) defaultValue $ looku -- > a_double = 4.0 -- > thatIsABoolean = True -- > a_double = 5.0 +-- > diffTime = 1 day +-- > otherDiffTime = 3 hours -- -- If two or more bindings have the same name, only the last one is kept. +-- Accepted duration values are seconds, minutes, hours, days and weeks. -- $import -- @@ -107,15 +110,18 @@ lookupDefault defaultValue name config = foldl (flip const) defaultValue $ looku -- > port = 3000 -- > mailFrom = "no-reply@mail.com" -- > currency = "$" +-- > expiration = 30 minutes -- -- Read the configuration: -- -- > import qualified Data.ConfigManager as Conf +-- > import Data.Time.Clock (DiffTime) -- > -- > data Conf = Conf -- > { port :: Int -- > , mailFrom :: String -- > , currency :: String +-- > , expiration :: DiffTime -- > } deriving (Read, Eq, Show) -- > -- > getConfig :: IO (Either Text Conf) @@ -125,5 +131,6 @@ lookupDefault defaultValue name config = foldl (flip const) defaultValue $ looku -- > Conf <$> -- > Conf.lookup "port" conf <*> -- > Conf.lookup "mailFrom" conf <*> --- > Conf.lookup "currency" conf +-- > Conf.lookup "currency" conf <*> +-- > Conf.lookup "expiration" conf -- > ) @@ -3,6 +3,8 @@ Config Manager A configuration management library. +[http://hackage.haskell.org/packages/archive/config-manager/latest/doc/html/Data-ConfigManager.html](http://hackage.haskell.org/packages/archive/config-manager/latest/doc/html/Data-ConfigManager.html) + TODO ---- |