This repository was archived by the owner on Aug 18, 2020. It is now read-only.
File tree Expand file tree Collapse file tree 5 files changed +16
-18
lines changed
wallet-new/src/Cardano/Wallet Expand file tree Collapse file tree 5 files changed +16
-18
lines changed Original file line number Diff line number Diff line change @@ -164,9 +164,9 @@ walletAddressOption na =
164164 where
165165 helpMsg = " IP and port for backend wallet API."
166166
167- docAddressOption :: Maybe NetworkAddress -> Opt. Parser NetworkAddress
167+ docAddressOption :: Maybe NetworkAddress -> Opt. Parser ( Maybe NetworkAddress )
168168docAddressOption na =
169- Opt. option (fromParsec addrParser) $
169+ Opt. optional $ Opt. option (fromParsec addrParser) $
170170 Opt. long " wallet-doc-address"
171171 <> Opt. metavar " IP:PORT"
172172 <> Opt. help helpMsg
Original file line number Diff line number Diff 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 [] (\ x -> [x]) (Plugins. docServer params)
105104 -- The monitoring API for the Core node.
106105 , Plugins. monitoringServer params
107106 ]
Original file line number Diff line number Diff 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 ) <$>
Original file line number Diff line number Diff line change @@ -91,11 +91,11 @@ walletDocumentation
9191 :: (HasConfigurations , HasCompileInfo )
9292 => WalletBackendParams
9393 -> Plugin WalletWebMode
94- walletDocumentation WalletBackendParams {.. } = pure ( " wallet doc worker" , const worker)
94+ walletDocumentation WalletBackendParams {.. } = maybe [] ( \ addr -> [ ( " wallet doc worker" , const $ worker addr) ]) walletDocAddress
9595 where
96- worker = walletDocumentationImpl
96+ worker addr = walletDocumentationImpl
9797 application
98- walletDocAddress
98+ addr
9999 tls
100100 (Just defaultSettings)
101101 Nothing
Original file line number Diff line number Diff line change @@ -126,17 +126,16 @@ apiServer protocolMagic (NewWalletBackendParams WalletBackendParams{..}) (passiv
126126docServer
127127 :: (HasConfigurations , HasCompileInfo )
128128 => NewWalletBackendParams
129- -> Plugin Kernel. WalletMode
130- docServer (NewWalletBackendParams WalletBackendParams {.. }) = const $
131- serveDocImpl
129+ -> Maybe (Text , Plugin Kernel. WalletMode )
130+ docServer (NewWalletBackendParams WalletBackendParams {.. }) = maybe Nothing (\ addr -> Just (" doc worker" , makeWalletServer addr)) walletDocAddress
131+ where
132+ makeWalletServer (ip, port) = const $ serveDocImpl
132133 application
133134 (BS8. unpack ip)
134135 port
135136 (if isDebugMode walletRunMode then Nothing else walletTLSParams)
136137 (Just defaultSettings)
137138 Nothing
138- where
139- (ip, port) = walletDocAddress
140139
141140 application :: Kernel. WalletMode Application
142141 application =
You can’t perform that action at this time.
0 commit comments