diff --git a/lib/cli/src/Cardano/CLI.hs b/lib/cli/src/Cardano/CLI.hs index 6f2f4aa205a..48b6cc38f5d 100644 --- a/lib/cli/src/Cardano/CLI.hs +++ b/lib/cli/src/Cardano/CLI.hs @@ -53,7 +53,7 @@ module Cardano.CLI , stateDirOption , syncToleranceOption , tlsOption - , smashURLOption + , poolMetadataSourceOption , metadataOption -- * Option parsers for configuring tracing @@ -1318,15 +1318,17 @@ tlsOption = TlsConfiguration <> metavar "FILE" <> help "The RSA Server key which signed the x.509 server certificate." -smashURLOption +poolMetadataSourceOption :: Parser PoolMetadataSource -smashURLOption = option (eitherReader reader) $ mempty +poolMetadataSourceOption = option (eitherReader reader) $ mempty <> long "pool-metadata-fetching" - <> metavar "STRATEGY" - <> help "Pool Metadata fetching strategy. This setting will persist across restarts. Possible values: \ - \ none, \ - \ direct, \ - \ ." + <> metavar "( none | direct | SMASH-URL )" + <> help ("Sets the stake pool metadata fetching strategy. " + <> "Provide a URL to specify a SMASH metadata proxy server, " + <> "use \"direct\" to fetch directly from the registered pool URLs," + <> " or \"none\" to completely disable stake pool" + <> " metadata. The initial setting is \"none\" and changes by" + <> " either this option or the API will persist across restarts.") where reader :: String -> Either String PoolMetadataSource reader = left (const err) . fromTextS @PoolMetadataSource diff --git a/lib/cli/test/unit/Cardano/CLISpec.hs b/lib/cli/test/unit/Cardano/CLISpec.hs index c5d4000217e..53edd730956 100644 --- a/lib/cli/test/unit/Cardano/CLISpec.hs +++ b/lib/cli/test/unit/Cardano/CLISpec.hs @@ -29,7 +29,7 @@ import Cardano.CLI , hGetLine , hGetSensitiveLine , metadataOption - , smashURLOption + , poolMetadataSourceOption ) import Cardano.Wallet.Api.Client ( addressClient @@ -648,9 +648,10 @@ spec = do , expectedResult = "pata14" :: Text } - describe "SMASH URL option" $ do + describe "Pool metadata fetching option" $ do let parse arg = execParserPure defaultPrefs - (info smashURLOption mempty) ["--pool-metadata-fetching", arg] + (info poolMetadataSourceOption mempty) + ["--pool-metadata-fetching", arg] let ok arg (Success url) = Right url == fromText @PoolMetadataSource (T.pack arg) ok _ _ = False diff --git a/lib/shelley/exe/cardano-wallet.hs b/lib/shelley/exe/cardano-wallet.hs index c8dd52bf6e8..85de90718b9 100644 --- a/lib/shelley/exe/cardano-wallet.hs +++ b/lib/shelley/exe/cardano-wallet.hs @@ -51,10 +51,10 @@ import Cardano.CLI , loggingOptions , loggingSeverityOrOffReader , loggingTracers + , poolMetadataSourceOption , runCli , setupDirectory , shutdownHandlerFlag - , smashURLOption , syncToleranceOption , tlsOption , withLogging @@ -175,7 +175,7 @@ data ServeArgs = ServeArgs , _database :: Maybe FilePath , _syncTolerance :: SyncTolerance , _enableShutdownHandler :: Bool - , _smashOpt :: Maybe PoolMetadataSource + , _poolMetadataSourceOpt :: Maybe PoolMetadataSource , _logging :: LoggingOptions TracerSeverities } deriving (Show) @@ -195,7 +195,7 @@ cmdServe = command "serve" $ info (helper <*> helper' <*> cmd) $ mempty <*> optional databaseOption <*> syncToleranceOption <*> shutdownHandlerFlag - <*> optional smashURLOption + <*> optional poolMetadataSourceOption <*> loggingOptions tracerSeveritiesOption exec :: ServeArgs -> IO () @@ -208,7 +208,7 @@ cmdServe = command "serve" $ info (helper <*> helper' <*> cmd) $ mempty databaseDir sTolerance enableShutdownHandler - smashURL + poolMetadataFetching logOpt) = do withTracers logOpt $ \tr tracers -> do installSignalHandlers (logNotice tr MsgSigTerm) @@ -232,7 +232,7 @@ cmdServe = command "serve" $ info (helper <*> helper' <*> cmd) $ mempty host listen tlsConfig - (fmap Settings smashURL) + (fmap Settings poolMetadataFetching) nodeSocket block0 (gp, vData)