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.

39 lines
848 B

8 years ago
8 years ago
8 years ago
  1. package main
  2. import (
  3. "flag"
  4. . "github.com/tendermint/go-common"
  5. "github.com/tendermint/abci/example/dummy"
  6. "github.com/tendermint/abci/server"
  7. "github.com/tendermint/abci/types"
  8. )
  9. func main() {
  10. addrPtr := flag.String("addr", "tcp://0.0.0.0:46658", "Listen address")
  11. abciPtr := flag.String("abci", "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. srv, err := server.NewServer(*addrPtr, *abciPtr, app)
  23. if err != nil {
  24. Exit(err.Error())
  25. }
  26. // Wait forever
  27. TrapSignal(func() {
  28. // Cleanup
  29. srv.Stop()
  30. })
  31. }