2022-12-06 21:48:34 +03:00
|
|
|
package main
|
|
|
|
|
2022-12-07 21:29:01 +03:00
|
|
|
import (
|
|
|
|
"flag"
|
|
|
|
"log"
|
|
|
|
|
2023-03-31 20:08:38 +03:00
|
|
|
"git.ukamnya.ru/stulyaganov/RestApiv2/internal/restserver"
|
2023-01-03 19:27:10 +03:00
|
|
|
"github.com/joho/godotenv"
|
2022-12-07 21:29:01 +03:00
|
|
|
)
|
|
|
|
|
|
|
|
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() {
|
2022-12-07 21:29:01 +03:00
|
|
|
|
|
|
|
flag.Parse()
|
2023-01-03 19:27:10 +03:00
|
|
|
godotenv.Load(".env")
|
2022-12-07 21:29:01 +03:00
|
|
|
|
|
|
|
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
|
|
|
}
|