RestApiv2/cmd/rest/main.go

33 lines
524 B
Go
Raw Normal View History

2022-12-06 21:48:34 +03:00
package main
import (
"flag"
"log"
2023-03-31 20:08:38 +03:00
"git.ukamnya.ru/stulyaganov/RestApiv2/internal/restserver"
"github.com/joho/godotenv"
)
var (
configPath string
)
func init() {
flag.StringVar(&configPath, "config-path", "configs/restServer/config.yaml", "path for config file")
}
2022-12-06 21:48:34 +03:00
func main() {
flag.Parse()
godotenv.Load(".env")
config := restserver.NewConfig()
if err := config.SetConfig(configPath); err != nil {
log.Fatal(err)
}
s := restserver.New(config)
if err := s.Start(); err != nil {
log.Fatal(err)
}
2022-12-06 21:48:34 +03:00
}