Extract persistence code into own class
This commit is contained in:
parent
4c76530832
commit
c5ebbc3c40
9 changed files with 163 additions and 149 deletions
8
main.go
8
main.go
|
@ -7,13 +7,14 @@ import (
|
|||
"os/signal"
|
||||
"syscall"
|
||||
|
||||
"github.com/mdiluz/rove/pkg/persistence"
|
||||
"github.com/mdiluz/rove/pkg/server"
|
||||
"github.com/mdiluz/rove/pkg/version"
|
||||
)
|
||||
|
||||
var ver = flag.Bool("version", false, "Display version number")
|
||||
var port = flag.Int("port", 8080, "The port to host on")
|
||||
var data = flag.String("data", "/tmp/", "Directory to store persistant data")
|
||||
var data = flag.String("data", os.TempDir(), "Directory to store persistant data")
|
||||
|
||||
func main() {
|
||||
flag.Parse()
|
||||
|
@ -23,9 +24,12 @@ func main() {
|
|||
os.Exit(0)
|
||||
}
|
||||
|
||||
// Set the persistence path
|
||||
persistence.SetPath(*data)
|
||||
|
||||
s := server.NewServer(
|
||||
server.OptionPort(*port),
|
||||
server.OptionPersistentData(*data))
|
||||
server.OptionPersistentData())
|
||||
|
||||
fmt.Println("Initialising...")
|
||||
if err := s.Initialise(); err != nil {
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue