@@ -33,7 +33,7 @@ import Control.Concurrent.STM.TMVar (TMVar)
3333import Control.Exception (Exception )
3434import Control.Lens hiding ((.=) )
3535import Data.Aeson (FromJSON (.. ), ToJSON (.. ), object , withObject ,
36- (.:) , (.:?) , (.=) )
36+ (.:) , (.:?) , (.=) )
3737import Data.Int (Int64 )
3838import Data.Text (Text )
3939import Data.Typeable (Typeable )
@@ -44,7 +44,8 @@ import System.Metrics.Gauge (Gauge)
4444import System.Remote.Monitoring.Statsd (StatsdOptions (.. ))
4545
4646import Cardano.Wallet.API.V1.Types (AccountIndex , Payment ,
47- PaymentSource (.. ), V1 , WalletId (.. ))
47+ PaymentSource (.. ), V1 ,
48+ WalletId (.. ))
4849import Cardano.Wallet.Client (ClientError (.. ), WalletClient (.. ))
4950import Pos.Core (Address (.. ))
5051import Pos.Util.Mnemonic (Mnemonic )
@@ -173,8 +174,10 @@ data FaucetConfig = FaucetConfig {
173174 , _fcPubCertFile :: ! FilePath
174175 -- | TLS private key
175176 , _fcPrivKeyFile :: ! FilePath
176- -- | Recapctch sectret key. Absence indicates not to use recaptcha
177- , _fcRecaptchaSecret :: ! (Maybe CaptchaSecret )
177+ -- | File path containing recapctch sectret key.
178+ --
179+ -- Absence indicates not to use recaptcha
180+ , _fcRecaptchaSecretFile :: ! (Maybe FilePath )
178181 }
179182
180183makeClassy ''FaucetConfig
@@ -191,7 +194,7 @@ instance FromJSON FaucetConfig where
191194 <*> v .: " logging-config"
192195 <*> v .: " public-certificate"
193196 <*> v .: " private-key"
194- <*> ( fmap CaptchaSecret <$> v .:? " recaptcha-secret" )
197+ <*> v .:? " recaptcha-secret-file "
195198
196199--------------------------------------------------------------------------------
197200-- | Details of a wallet created by the faucet at run time if 'Generate' is used
@@ -257,23 +260,25 @@ makeLenses ''ProcessorPayload
257260-- | Run time environment for faucet's reader Monad
258261data FaucetEnv = FaucetEnv {
259262 -- | Counter for total amount withdawn from a wallet while faucet is running
260- _feWithdrawn :: ! Counter
263+ _feWithdrawn :: ! Counter
261264 -- | Counter for number of withdrawals made
262- , _feNumWithdrawn :: ! Counter
265+ , _feNumWithdrawn :: ! Counter
263266 -- | Gauge for wallet balance
264- , _feWalletBalance :: ! Gauge
267+ , _feWalletBalance :: ! Gauge
265268 -- | Metrics store
266- , _feStore :: ! Store
269+ , _feStore :: ! Store
267270 -- | Config for source of funds
268- , _feSourceWallet :: ! SourceWalletConfig
271+ , _feSourceWallet :: ! SourceWalletConfig
269272 -- | Return address for sending ADA back to the faucet
270- , _feReturnAddress :: ! (V1 Address )
273+ , _feReturnAddress :: ! (V1 Address )
271274 -- | Original static config object
272- , _feFaucetConfig :: ! FaucetConfig
275+ , _feFaucetConfig :: ! FaucetConfig
273276 -- | Client for communicating with wallet API
274- , _feWalletClient :: ! (WalletClient IO )
277+ , _feWalletClient :: ! (WalletClient IO )
275278 -- | Lock to ensure only one withdrawal at a time
276- , _feWithdrawalQ :: ! (TBQueue ProcessorPayload )
279+ , _feWithdrawalQ :: ! (TBQueue ProcessorPayload )
280+ -- | Recaptcha secret read from 'fcRecaptchaSecretFile'
281+ , _feRecaptchaSecret :: ! (Maybe CaptchaSecret )
277282 }
278283
279284makeClassy ''FaucetEnv
0 commit comments