package main

import (
	"flag"
	"kv_api/config"
	"kv_api/dao"
	"kv_api/server"

	log "github.com/sirupsen/logrus"
)

func init() {
	log.SetFormatter(&log.TextFormatter{
		FullTimestamp: true,
	})
}

func main() {
	flag.Parse()
	conf, err := config.New()
	if err != nil {
		panic(err)
	}

	da, err := dao.New(conf)
	if err != nil {
		panic(err)
	}

	if conf.Debug {
		log.SetLevel(log.DebugLevel)
	}

	server.StartServer(da, conf)
}
