You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

38 lines
833 B

  1. package main
  2. import (
  3. "flag"
  4. . "github.com/tendermint/go-common"
  5. "github.com/tendermint/tmsp/example/dummy"
  6. "github.com/tendermint/tmsp/server"
  7. "github.com/tendermint/tmsp/types"
  8. )
  9. func main() {
  10. addrPtr := flag.String("addr", "tcp://0.0.0.0:46658", "Listen address")
  11. tmspPtr := flag.String("tmsp", "socket", "socket | grpc")
  12. persistencePtr := flag.String("persist", "", "directory to use for a database")
  13. flag.Parse()
  14. // Create the application - in memory or persisted to disk
  15. var app types.Application
  16. if *persistencePtr == "" {
  17. app = dummy.NewDummyApplication()
  18. } else {
  19. app = dummy.NewPersistentDummyApplication(*persistencePtr)
  20. }
  21. // Start the listener
  22. _, err := server.NewServer(*addrPtr, *tmspPtr, app)
  23. if err != nil {
  24. Exit(err.Error())
  25. }
  26. // Wait forever
  27. TrapSignal(func() {
  28. // Cleanup
  29. })
  30. }