Skip to content

Commit

Permalink
Remove deprecation notice for --mainnet flag (#3690)
Browse files Browse the repository at this point in the history
We planned to remove the `--mainnet` flag, as it seemed unnecessary, as
the client running without any network flag runs for mainnet by default.
But from an infrastructure administrator perspective, the flag may be
actually useful when running the application on multiple environments.
It's much easier to maintain a common template where the administrator
will have to change the value of the flag rather than set the flag for
some environments and remove it for mainnet.

When running the application for **mainnet** an administrator will have
two possibilities:
- add `--mainnet` flag,
- don't define any network flag.

When running the application for **testnet** an administrator will have
to add `--testnet` flag.
  • Loading branch information
dimpar authored Sep 12, 2023
2 parents 357cf76 + ca8bdb8 commit a226a86
Show file tree
Hide file tree
Showing 3 changed files with 3 additions and 14 deletions.
6 changes: 2 additions & 4 deletions cmd/flags.go
Original file line number Diff line number Diff line change
Expand Up @@ -77,12 +77,10 @@ func initGlobalConfigFlags(cmd *cobra.Command, configFilePath *string) {
// start command to run the client against test networks. Only one flag
// from this set is allowed.
func initGlobalNetworkFlags(cmd *cobra.Command) {
// TODO: Remove the mainnet flag.
// DEPRECATED
cmd.PersistentFlags().Bool(
network.Mainnet.String(),
false,
"Mainnet network (DEPRECATED)",
"Mainnet network",
)

cmd.PersistentFlags().Bool(
Expand All @@ -98,7 +96,7 @@ func initGlobalNetworkFlags(cmd *cobra.Command) {
)

cmd.MarkFlagsMutuallyExclusive(
network.Mainnet.String(), // TODO: Remove the mainnet flag.
network.Mainnet.String(),
network.Testnet.String(),
network.Developer.String(),
)
Expand Down
9 changes: 0 additions & 9 deletions config/config.go
Original file line number Diff line number Diff line change
Expand Up @@ -119,15 +119,6 @@ func (c *Config) ReadConfig(configFilePath string, flagSet *pflag.FlagSet, categ
if err != nil {
return fmt.Errorf("unable to resolve networks: [%w]", err)
}

// TODO: Remove the mainnet flag.
// DEPRECATED
if isMainnet, err := flagSet.GetBool(network.Mainnet.String()); err == nil && isMainnet {
logger.Warnf(
"--%s flag is deprecated, to run the client against the mainnet don't provide any network flag",
network.Mainnet.String(),
)
}
}

// Read configuration from a file if the config file path is set.
Expand Down
2 changes: 1 addition & 1 deletion docs/resources/client-start-help
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,7 @@ Flags:
Global Flags:
-c, --config string Path to the configuration file. Supported formats: TOML, YAML, JSON.
--developer Developer network
--mainnet Mainnet network (DEPRECATED)
--mainnet Mainnet network
--testnet Testnet network

Environment variables:
Expand Down

0 comments on commit a226a86

Please sign in to comment.