summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authormarkfine <>2018-01-05 23:40:00 (GMT)
committerhdiff <hdiff@hdiff.luite.com>2018-01-05 23:40:00 (GMT)
commit611a300c9a4347e5f411f9dd584853c3af14e3e6 (patch)
treea71bd11442063e481f63f547bb67af18ccaa4014
parentf529413f79ea64b41a7e848dd8fb09b65fb9f6ab (diff)
version 0.3.390.3.39
-rw-r--r--main/actor.hs9
-rw-r--r--main/counter.hs3
-rw-r--r--main/decider.hs3
-rw-r--r--src/Network/AWS/Wolf/Act.hs8
-rw-r--r--src/Network/AWS/Wolf/Count.hs7
-rw-r--r--src/Network/AWS/Wolf/Decide.hs7
-rw-r--r--src/Network/AWS/Wolf/Prelude.hs6
-rw-r--r--wolf.cabal2
8 files changed, 34 insertions, 11 deletions
diff --git a/main/actor.hs b/main/actor.hs
index c7dc459..ed4d438 100644
--- a/main/actor.hs
+++ b/main/actor.hs
@@ -16,6 +16,12 @@ data Args = Args
-- ^ Configuration file.
, quiesce :: Maybe FilePath
-- ^ Optional quiesce file to stop actor.
+ , domain :: Maybe Text
+ -- ^ Optional domain to use.
+ , bucket :: Maybe Text
+ -- ^ Optional bucket to use.
+ , prefix :: Maybe Text
+ -- ^ Optional prefix to use.
, queue :: Text
-- ^ Queue to listen to act on.
, num :: Maybe Int
@@ -38,6 +44,9 @@ main = do
actMain
(config args)
(quiesce args)
+ (domain args)
+ (bucket args)
+ (prefix args)
(queue args)
(fromMaybe 1 $ num args)
(nocopy args)
diff --git a/main/counter.hs b/main/counter.hs
index ca88dd8..aa7832f 100644
--- a/main/counter.hs
+++ b/main/counter.hs
@@ -16,6 +16,8 @@ data Args = Args
-- ^ Configuration file.
, plan :: FilePath
-- ^ Plan file to count on.
+ , domain :: Maybe Text
+ -- ^ Optional domain to use.
} deriving (Show, Generic)
instance ParseRecord Args
@@ -28,3 +30,4 @@ main = do
countMain
(config args)
(plan args)
+ (domain args)
diff --git a/main/decider.hs b/main/decider.hs
index 9e832fa..3ff0488 100644
--- a/main/decider.hs
+++ b/main/decider.hs
@@ -16,6 +16,8 @@ data Args = Args
-- ^ Configuration file.
, plan :: FilePath
-- ^ Plan file to decide on.
+ , domain :: Maybe Text
+ -- ^ Optional domain to use.
} deriving (Show, Generic)
instance ParseRecord Args
@@ -28,3 +30,4 @@ main = do
decideMain
(config args)
(plan args)
+ (domain args)
diff --git a/src/Network/AWS/Wolf/Act.hs b/src/Network/AWS/Wolf/Act.hs
index db4897b..750da95 100644
--- a/src/Network/AWS/Wolf/Act.hs
+++ b/src/Network/AWS/Wolf/Act.hs
@@ -105,14 +105,14 @@ act queue nocopy local command =
statsIncrement "wolf.act.activity.count" [ "queue" =. queue, "status" =. status ]
statsHistogram "wolf.act.activity.elapsed" (realToFrac (diffUTCTime t3 t2) :: Double) [ "queue" =. queue ]
-
-- | Run actor from main with config file.
--
-actMain :: MonadControl m => FilePath -> Maybe FilePath -> Text -> Int -> Bool -> Bool -> String -> m ()
-actMain cf quiesce queue num nocopy local command =
+actMain :: MonadControl m => FilePath -> Maybe FilePath -> Maybe Text -> Maybe Text -> Maybe Text -> Text -> Int -> Bool -> Bool -> String -> m ()
+actMain cf quiesce domain bucket prefix queue num nocopy local command =
runCtx $ runTop $ do
conf <- readYaml cf
- runConfCtx conf $
+ let conf' = override cPrefix prefix $ override cBucket bucket $ override cDomain domain conf
+ runConfCtx conf' $
runConcurrent $ replicate num $ forever $ do
ok <- check quiesce
when ok $
diff --git a/src/Network/AWS/Wolf/Count.hs b/src/Network/AWS/Wolf/Count.hs
index 89ae53c..2d3ea52 100644
--- a/src/Network/AWS/Wolf/Count.hs
+++ b/src/Network/AWS/Wolf/Count.hs
@@ -47,10 +47,11 @@ count p =
-- | Run counter from main with config file.
--
-countMain :: MonadControl m => FilePath -> FilePath -> m ()
-countMain cf pf =
+countMain :: MonadControl m => FilePath -> FilePath -> Maybe Text -> m ()
+countMain cf pf domain =
runCtx $ runTop $ do
conf <- readYaml cf
- runConfCtx conf $ do
+ let conf' = override cDomain domain conf
+ runConfCtx conf' $ do
plans <- readYaml pf
mapM_ count (plans :: [Plan])
diff --git a/src/Network/AWS/Wolf/Decide.hs b/src/Network/AWS/Wolf/Decide.hs
index 09bbbc4..ca4666c 100644
--- a/src/Network/AWS/Wolf/Decide.hs
+++ b/src/Network/AWS/Wolf/Decide.hs
@@ -110,11 +110,12 @@ decide p =
-- | Run decider from main with config file.
--
-decideMain :: MonadControl m => FilePath -> FilePath -> m ()
-decideMain cf pf =
+decideMain :: MonadControl m => FilePath -> FilePath -> Maybe Text -> m ()
+decideMain cf pf domain =
runCtx $ runTop $ do
conf <- readYaml cf
- runConfCtx conf $ do
+ let conf' = override cDomain domain conf
+ runConfCtx conf' $ do
plans <- readYaml pf
runConcurrent $
forever . decide <$> plans
diff --git a/src/Network/AWS/Wolf/Prelude.hs b/src/Network/AWS/Wolf/Prelude.hs
index b1df6a1..09abf45 100644
--- a/src/Network/AWS/Wolf/Prelude.hs
+++ b/src/Network/AWS/Wolf/Prelude.hs
@@ -7,6 +7,7 @@
module Network.AWS.Wolf.Prelude
( module Exports
, runConcurrent
+ , override
) where
import Control.Concurrent.Async.Lifted
@@ -16,3 +17,8 @@ import Preamble as Exports
--
runConcurrent :: MonadBaseControl IO m => [m a] -> m ()
runConcurrent = void . runConcurrently . traverse Concurrently
+
+-- | Override a lens value with a maybe value.
+--
+override :: ASetter s s a b -> Maybe b -> s -> s
+override k v c = maybe c (flip (set k) c) v
diff --git a/wolf.cabal b/wolf.cabal
index f8861a1..2704616 100644
--- a/wolf.cabal
+++ b/wolf.cabal
@@ -1,5 +1,5 @@
name: wolf
-version: 0.3.38
+version: 0.3.39
synopsis: Amazon Simple Workflow Service Wrapper.
description: Wolf is a wrapper around Amazon Simple Workflow Service.
homepage: https://github.com/swift-nav/wolf