IPv6DB 0.1.1 → 0.2.0
raw patch · 5 files changed
+31/−22 lines, 5 filesdep ~IPv6DBdep ~aesonPVP ok
version bump matches the API change (PVP)
Dependency ranges changed: IPv6DB, aeson
API changes (from Hackage documentation)
Files
- IPv6DB.cabal +6/−6
- README.md +7/−6
- app/Main.hs +4/−1
- app/Options.hs +12/−6
- app/Queries.hs +2/−3
IPv6DB.cabal view
@@ -1,5 +1,5 @@ name: IPv6DB-version: 0.1.1+version: 0.2.0 cabal-version: >=1.10 build-type: Simple license: BSD3@@ -27,7 +27,7 @@ exposed-modules: Network.IPv6DB.Types build-depends:- aeson >=0.11.2 && <1.2,+ aeson >=0.11.2 && <1.3, attoparsec >=0.13.1.0 && <0.14, base >=4.9.0 && <5.0, bytestring >=0.10.6 && <0.11,@@ -44,12 +44,12 @@ executable ipv6db main-is: Main.hs build-depends:- aeson >=0.11.2 && <1.2,+ aeson >=0.11.2 && <1.3, base >=4.9.0 && <5.0, bytestring >=0.10.6 && <0.11, fast-logger >=2.4.8 && <2.5, IPv6Addr >=1.0.0 && <1.1.0,- IPv6DB >=0.1.1 && <0.2,+ IPv6DB >=0.2.0 && <0.3, hedis >=0.9.4 && <0.10, http-types >=0.9.1 && <0.10, unordered-containers >=0.2.7.2 && <0.2.9,@@ -72,10 +72,10 @@ type: exitcode-stdio-1.0 main-is: hspec.hs build-depends:- aeson >=0.11.2 && <1.2,+ aeson >=0.11.2 && <1.3, hspec >=2.1.10 && <2.5, base >=4.8 && <5,- IPv6DB >=0.1.1 && <0.2,+ IPv6DB >=0.2.0 && <0.3, vector >=0.11.0.0 && <0.13, http-client >=0.4.31.2 && <0.6, http-types >=0.9.1 && <0.10
README.md view
@@ -6,18 +6,19 @@ ```bash [user@box ~]$ ipv6db --help-IPv6DB v0.1.0 APIv1, (c) Michel Boucey 2017+IPv6DB v0.2.0 APIv1, (c) Michel Boucey 2017 -Usage: ipv6db [-p|--port] [-h|--redis-host ARG] [-r|--redis-port]+Usage: ipv6db [-h|--host ARG] [-p|--port ARG] [-l|--log-file ARG]+ [-o|--redis-host ARG] [-r|--redis-port ARG] [-d|--redis-database ARG] [-a|--redis-auth ARG]- [-l|--log-file ARG] RESTful Web Service for IPv6 related data Available options:- -p,--port Alternative listening port (default: 4446)+ -h,--host ARG Alternative host (default: "::")+ -p,--port ARG Alternative listening port (default: 4446) -l,--log-file ARG Log file (default: "/var/log/ipv6db.log")- -h,--redis-host ARG Redis host (default: "localhost")- -r,--redis-port Redis listening port (default: 6379)+ -o,--redis-host ARG Redis host (default: "localhost")+ -r,--redis-port ARG Redis listening port (default: 6379) -d,--redis-database ARG Redis database (default: 0) -a,--redis-auth ARG Redis authentication password -h,--help Show this help text
app/Main.hs view
@@ -8,6 +8,7 @@ import qualified Data.ByteString.Lazy as BSL import Data.Maybe (fromJust) import Data.Monoid ((<>))+import Data.String (fromString) import qualified Data.Vector as V import Database.Redis hiding (String) import Network.HTTP.Types hiding (noContent204)@@ -33,7 +34,9 @@ FromSocket (LogFileNoRotate logFile defaultBufSize) timeCache- run appPort (ipv6db apLog)+ runSettings+ (setPort appPort $ setHost (fromString appHost) defaultSettings)+ (ipv6db apLog) ipv6db :: ApacheLogger -> Application ipv6db logger req res = do
app/Options.hs view
@@ -7,7 +7,8 @@ data Options = Options- { appPort :: Int+ { appHost :: String+ , appPort :: Int , logFile :: String , redisHost :: String , redisPort :: Integer@@ -25,13 +26,19 @@ options = Options <$>+ strOption+ ( short 'h'+ <> long "host"+ <> help "Alternative host"+ <> showDefault+ <> value "::" )+ <*> option auto ( short 'p' <> long "port" <> help "Alternative listening port" <> showDefault- <> value 4446- <> metavar "" )+ <> value 4446 ) <*> strOption ( short 'l'@@ -41,7 +48,7 @@ <> value "/var/log/ipv6db.log" ) <*> strOption- ( short 'h'+ ( short 'o' <> long "redis-host" <> help "Redis host" <> showDefault@@ -52,8 +59,7 @@ <> long "redis-port" <> help "Redis listening port" <> showDefault- <> value 6379- <> metavar "" )+ <> value 6379 ) <*> option auto ( short 'd'
app/Queries.hs view
@@ -148,15 +148,14 @@ -> BS.ByteString -> Maybe Resource toResource list addr mi bs =- case decode (BSL.fromStrict bs) of- Just src -> Just+ decode (BSL.fromStrict bs) >>= \src ->+ Just $ Resource { list = list , address = IPv6Addr addr , ttl = mi , source = Source src }- Nothing -> Nothing maybeResource :: Value -> [(T.Text,Value)]