package main

import (
	"log"

	"github.com/FernandoVideira/LK_API_Temp/internal/db"
	"github.com/FernandoVideira/LK_API_Temp/internal/env"
	"github.com/FernandoVideira/LK_API_Temp/internal/store"
)

func main() {
	addr := env.GetString("DB_ADDR", "postgres://postgres:postgres@localhost:5432/lk_tmpl?sslmode=disable")
	conn, err := db.New(addr, 3, 3, env.GetDuration("DB_MAX_IDLE_TIME", "5m"))
	if err != nil {
		log.Fatalf("could not connect to db: %v", err)
	}
	defer conn.Close()

	store := store.NewStorage(conn)
	db.Seed(store, conn)
}
