package main

import (
	"sparrow/pkg/rpcs"
	"sparrow/pkg/server"
)

func main() {
	// init server
	err := server.Init(rpcs.DeviceManagerName)
	if err != nil {
		server.Log.Fatal(err)
		return
	}

	// register a rpc manager
	dm := NewDeviceManager(*confRedisHost, *confRedisPort, *confRedisDb)
	err = server.RegisterRPCHandler(dm)
	if err != nil {
		server.Log.Errorf("Register RPC manager Error: %s", err)
		return
	}

	// start to run
	err = server.Run()
	if err != nil {
		server.Log.Fatal(err)
	}
}
