Skip to content
This repository was archived by the owner on Aug 18, 2020. It is now read-only.

Commit 42d8593

Browse files
authored
Merge pull request #3825 from input-output-hk/devops-1099-develop
[DEVOPS-1099] make the wallet documentation optional, and default it to off
2 parents 85edc58 + c4d0f58 commit 42d8593

File tree

4 files changed

+16
-15
lines changed

4 files changed

+16
-15
lines changed

lib/src/Pos/Client/CLI/Options.hs

+2-2
Original file line numberDiff line numberDiff line change
@@ -172,9 +172,9 @@ walletAddressOption na =
172172
where
173173
helpMsg = "IP and port for backend wallet API."
174174

175-
docAddressOption :: Maybe NetworkAddress -> Opt.Parser NetworkAddress
175+
docAddressOption :: Maybe NetworkAddress -> Opt.Parser (Maybe NetworkAddress)
176176
docAddressOption na =
177-
Opt.option (fromParsec addrParser) $
177+
Opt.optional $ Opt.option (fromParsec addrParser) $
178178
Opt.long "wallet-doc-address"
179179
<> Opt.metavar "IP:PORT"
180180
<> Opt.help helpMsg

wallet-new/src/Cardano/Wallet/Action.hs

+4-5
Original file line numberDiff line numberDiff line change
@@ -91,17 +91,16 @@ actionWithWallet params genesisConfig walletConfig txpConfig ntpConfig nodeParam
9191
, unsupportedMimeTypeMiddleware
9292
])
9393

94-
-- The corresponding wallet documention, served as a different
95-
-- server which doesn't require client x509 certificates to
96-
-- connect, but still serves the doc through TLS
97-
, ("doc worker", Plugins.docServer params)
98-
9994
-- Periodically compact & snapshot the acid-state database.
10095
, ("acid state cleanup", Plugins.acidStateSnapshots (view Kernel.Internal.wallets (snd w)) params dbMode)
10196

10297
-- A @Plugin@ to watch and store incoming update proposals
10398
, ("update watcher", Plugins.updateWatcher)
10499
]
100+
-- The corresponding wallet documention, served as a different
101+
-- server which doesn't require client x509 certificates to
102+
-- connect, but still serves the doc through TLS
103+
, maybe [] (pure . ("doc server",)) (Plugins.docServer params)
105104
-- The monitoring API for the Core node.
106105
, Plugins.monitoringServer params
107106
]

wallet-new/src/Cardano/Wallet/Server/CLI.hs

+3-3
Original file line numberDiff line numberDiff line change
@@ -57,7 +57,7 @@ data WalletBackendParams = WalletBackendParams
5757
-- ^ The TLS parameters.
5858
, walletAddress :: !NetworkAddress
5959
-- ^ The wallet address.
60-
, walletDocAddress :: !NetworkAddress
60+
, walletDocAddress :: !(Maybe NetworkAddress)
6161
-- ^ The wallet documentation address.
6262
, walletRunMode :: !RunMode
6363
-- ^ The mode this node is running in.
@@ -157,8 +157,8 @@ walletBackendParamsParser = WalletBackendParams <$> enableMonitoringApiParser
157157
addressParser :: Parser NetworkAddress
158158
addressParser = CLI.walletAddressOption $ Just (localhost, 8090)
159159

160-
docAddressParser :: Parser NetworkAddress
161-
docAddressParser = CLI.docAddressOption $ Just (localhost, 8091)
160+
docAddressParser :: Parser (Maybe NetworkAddress)
161+
docAddressParser = CLI.docAddressOption Nothing
162162

163163
runModeParser :: Parser RunMode
164164
runModeParser = (\debugMode -> if debugMode then DebugMode else ProductionMode) <$>

wallet-new/src/Cardano/Wallet/Server/Plugins.hs

+7-5
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,5 @@
1+
{-# LANGUAGE NamedFieldPuns #-}
2+
13
{- | A collection of plugins used by this edge node.
24
A @Plugin@ is essentially a set of actions which will be run in
35
a particular monad, at some point in time.
@@ -123,17 +125,17 @@ apiServer (NewWalletBackendParams WalletBackendParams{..}) (passiveLayer, passiv
123125
docServer
124126
:: (HasConfigurations, HasCompileInfo)
125127
=> NewWalletBackendParams
126-
-> Plugin Kernel.WalletMode
127-
docServer (NewWalletBackendParams WalletBackendParams{..}) = const $
128-
serveDocImpl
128+
-> Maybe (Plugin Kernel.WalletMode)
129+
docServer (NewWalletBackendParams WalletBackendParams{walletDocAddress = Nothing}) = Nothing
130+
docServer (NewWalletBackendParams WalletBackendParams{walletDocAddress = Just (ip, port), walletRunMode, walletTLSParams}) = Just (const $ makeWalletServer)
131+
where
132+
makeWalletServer = serveDocImpl
129133
application
130134
(BS8.unpack ip)
131135
port
132136
(if isDebugMode walletRunMode then Nothing else walletTLSParams)
133137
(Just defaultSettings)
134138
Nothing
135-
where
136-
(ip, port) = walletDocAddress
137139

138140
application :: Kernel.WalletMode Application
139141
application =

0 commit comments

Comments
 (0)