diff options
Diffstat (limited to 'acme-certify.hs')
-rw-r--r-- | acme-certify.hs | 10 |
1 files changed, 7 insertions, 3 deletions
diff --git a/acme-certify.hs b/acme-certify.hs index 8bad7ac..049ba5a 100644 --- a/acme-certify.hs +++ b/acme-certify.hs | |||
@@ -16,7 +16,7 @@ | |||
16 | module Main where | 16 | module Main where |
17 | 17 | ||
18 | import BasePrelude | 18 | import BasePrelude |
19 | import Control.Lens hiding ((&)) | 19 | import Control.Lens hiding ((&), argument) |
20 | import Control.Monad.IO.Class | 20 | import Control.Monad.IO.Class |
21 | import Control.Monad.Trans.Resource | 21 | import Control.Monad.Trans.Resource |
22 | import Data.Aeson.Lens | 22 | import Data.Aeson.Lens |
@@ -89,7 +89,8 @@ data CertifyOpts = CertifyOpts { | |||
89 | } | 89 | } |
90 | 90 | ||
91 | data UpdateOpts = UpdateOpts { | 91 | data UpdateOpts = UpdateOpts { |
92 | updateConfigFile :: Maybe FilePath | 92 | updateConfigFile :: Maybe FilePath, |
93 | updateHosts :: [String] | ||
93 | } | 94 | } |
94 | 95 | ||
95 | instance Show HttpProvisioner where | 96 | instance Show HttpProvisioner where |
@@ -111,6 +112,7 @@ updateOpts = fmap Update $ | |||
111 | (long "config" <> | 112 | (long "config" <> |
112 | metavar "FILENAME" <> | 113 | metavar "FILENAME" <> |
113 | help "location of YAML configuration file")) | 114 | help "location of YAML configuration file")) |
115 | <*> many (argument str (metavar "HOSTS")) | ||
114 | 116 | ||
115 | certifyOpts :: Parser Command | 117 | certifyOpts :: Parser Command |
116 | certifyOpts = fmap Certify $ | 118 | certifyOpts = fmap Certify $ |
@@ -187,7 +189,9 @@ runUpdate UpdateOpts { .. } = do | |||
187 | 189 | ||
188 | issuerCert <- readX509 letsEncryptX1CrossSigned | 190 | issuerCert <- readX509 letsEncryptX1CrossSigned |
189 | 191 | ||
190 | forM_ certReqDomains $ \(host, domain, domains) -> when (host == "fifty") $ do | 192 | let wantUpdate h = null updateHosts || isJust (find (== h) updateHosts) |
193 | |||
194 | forM_ certReqDomains $ \(host, domain, domains) -> when (wantUpdate host) $ do | ||
191 | putStrLn host | 195 | putStrLn host |
192 | let Just spec = dereference (map (chooseProvisioner host) domains) <&> certSpec globalCertificateDir keys host domain | 196 | let Just spec = dereference (map (chooseProvisioner host) domains) <&> certSpec globalCertificateDir keys host domain |
193 | print spec | 197 | print spec |