package main

import (
	"flag"
	"sparrow/pkg/rpcs"
	"sparrow/pkg/server"
	"sparrow/services/timer-service/internal"
)

const (
	flagRabbitHost    = "rabbithost"
	defaultRabbitHost = "amqp://guest:guest@localhost:5672/"
)

var (
	confRabbitHost = flag.String(flagRabbitHost, defaultRabbitHost, "rabbitmq host address, amqp://user:password@ip:port/")
)

func main() {
	// init server
	err := server.Init(rpcs.TimerServiceName)
	if err != nil {
		server.Log.Fatal(err)
		return
	}
	internal.NewTimerService(*confRabbitHost)
	err = server.Run()
	if err != nil {
		server.Log.Fatal(err)
	}
}
