flags_legacy.go 3.0 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980
  1. // Copyright 2020 The go-ethereum Authors
  2. // This file is part of go-ethereum.
  3. //
  4. // go-ethereum is free software: you can redistribute it and/or modify
  5. // it under the terms of the GNU General Public License as published by
  6. // the Free Software Foundation, either version 3 of the License, or
  7. // (at your option) any later version.
  8. //
  9. // go-ethereum is distributed in the hope that it will be useful,
  10. // but WITHOUT ANY WARRANTY; without even the implied warranty of
  11. // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
  12. // GNU General Public License for more details.
  13. //
  14. // You should have received a copy of the GNU General Public License
  15. // along with go-ethereum. If not, see <http://www.gnu.org/licenses/>.
  16. package utils
  17. import (
  18. "fmt"
  19. "strings"
  20. "github.com/ethereum/go-ethereum/node"
  21. "gopkg.in/urfave/cli.v1"
  22. )
  23. var ShowDeprecated = cli.Command{
  24. Action: showDeprecated,
  25. Name: "show-deprecated-flags",
  26. Usage: "Show flags that have been deprecated",
  27. ArgsUsage: " ",
  28. Category: "MISCELLANEOUS COMMANDS",
  29. Description: "Show flags that have been deprecated and will soon be removed",
  30. }
  31. var DeprecatedFlags = []cli.Flag{}
  32. var (
  33. // (Deprecated May 2020, shown in aliased flags section)
  34. LegacyRPCEnabledFlag = cli.BoolFlag{
  35. Name: "rpc",
  36. Usage: "Enable the HTTP-RPC server (deprecated and will be removed in the future, use --http)",
  37. }
  38. LegacyRPCListenAddrFlag = cli.StringFlag{
  39. Name: "rpcaddr",
  40. Usage: "HTTP-RPC server listening interface (deprecated and will be removed in the future, use --http.addr)",
  41. Value: node.DefaultHTTPHost,
  42. }
  43. LegacyRPCPortFlag = cli.IntFlag{
  44. Name: "rpcport",
  45. Usage: "HTTP-RPC server listening port (deprecated and will be removed in the future, use --http.port)",
  46. Value: node.DefaultHTTPPort,
  47. }
  48. LegacyRPCCORSDomainFlag = cli.StringFlag{
  49. Name: "rpccorsdomain",
  50. Usage: "Comma separated list of domains from which to accept cross origin requests (browser enforced) (deprecated and will be removed in the future, use --http.corsdomain)",
  51. Value: "",
  52. }
  53. LegacyRPCVirtualHostsFlag = cli.StringFlag{
  54. Name: "rpcvhosts",
  55. Usage: "Comma separated list of virtual hostnames from which to accept requests (server enforced). Accepts '*' wildcard. (deprecated and will be removed in the future, use --http.vhosts)",
  56. Value: strings.Join(node.DefaultConfig.HTTPVirtualHosts, ","),
  57. }
  58. LegacyRPCApiFlag = cli.StringFlag{
  59. Name: "rpcapi",
  60. Usage: "API's offered over the HTTP-RPC interface (deprecated and will be removed in the future, use --http.api)",
  61. Value: "",
  62. }
  63. )
  64. // showDeprecated displays deprecated flags that will be soon removed from the codebase.
  65. func showDeprecated(*cli.Context) {
  66. fmt.Println("--------------------------------------------------------------------")
  67. fmt.Println("The following flags are deprecated and will be removed in the future!")
  68. fmt.Println("--------------------------------------------------------------------")
  69. fmt.Println()
  70. // TODO remove when there are newly deprecated flags
  71. fmt.Println("no deprecated flags to show at this time")
  72. fmt.Println()
  73. }