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.

40 lines
866 B

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