anycable-go icon indicating copy to clipboard operation
anycable-go copied to clipboard

Refactor CLI

Open gzigzigzeo opened this issue 2 years ago • 0 comments

What is the purpose of this pull request?

Refactor cli namespace.

What changes did you make? (overview)

  • [x] Implemented declarative CLI args specification using github.com/urfave/cli/v2.
  • [x] cli.Option in style of NATS server configurator.
  • [x] Refactored cli.Runner

Checklist

  • [ ] I've added tests for this change
  • [ ] I've added a Changelog entry
  • [ ] I've updated documentation
NAME:
   anycable-go - AnyCable-Go, The WebSocket server for https://anycable.io

USAGE:
   anycable-go [global options] [arguments...]

VERSION:
   1.2.1-562d4b8

GLOBAL OPTIONS:
   --help, -h     show help (default: false)
   --version, -v  print the version (default: false)

   ADAPTER:
   --broadcast_adapter value  Broadcasting adapter to use (redis, http or nats) (default: "redis") [$ANYCABLE_BROADCAST_ADAPTER]

   ANYCABLE-GO SERVER:
   --health-path value  HTTP health endpoint path (default: "/health") [$ANYCABLE_HEALTH_PATH]
   --host value         Server host (default: "localhost") [$ANYCABLE_HOST]
   --max-conn value     Limit simultaneous server connections (0 – without limit) (default: 0) [$ANYCABLE_MAX_CONN]
   --path value         WebSocket endpoint path (you can specify multiple paths using comma as separator) (default: "/cable") [$ANYCABLE_PATH]
   --port value         Server port (default: 8080) [$PORT, $ANYCABLE_PORT]

   DISCONNECT OPTIONS:
   --disable_disconnect        Disable calling Disconnect callback (default: false) [$ANYCABLE_DISABLE_DISCONNECT]
   --disconnect_rate value     Max number of Disconnect calls per second (default: 100) [$ANYCABLE_DISCONNECT_RATE]
   --disconnect_timeout value  Graceful shutdown timeouts (in seconds) (default: 5) [$ANYCABLE_DISCONNECT_TIMEOUT]

   EMBEDDED NATS SERVICE:
   --mnats_cluster_addr value  NATS cluster service bind address [$ANYCABLE_MNATS_CLUSTER_ADDR]
   --mnats_cluster_name value  NATS cluster name (default: "anycable-cluster") [$ANYCABLE_MNATS_CLUSTER_NAME]
   --mnats_debug               Enable NATS server debug logs. Automatically set to true if --debug is passed. (default: false) [$ANYCABLE_MNATS_DEBUG]
   --mnats_enable              Pass this option to enable embedded NATS server (default: false) [$ANYCABLE_MNATS_ENABLE]
   --mnats_log                 Enable NATS server logs (default: false) [$ANYCABLE_MNATS_LOG]
   --mnats_routes value        Comma separated list of known other cluster service addresses. [$ANYCABLE_MNATS_ROUTES]
   --mnats_service_addr value  NATS server bind address (default: "nats://127.0.0.1:4222") [$ANYCABLE_MNATS_SERVICE_ADDR]
   --mnats_trace               Enable NATS server protocol trace logs. (default: false) [$ANYCABLE_MNATS_TRACE]

gzigzigzeo avatar Aug 12 '22 11:08 gzigzigzeo