26 lines
618 B
Go
26 lines
618 B
Go
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, err := store.NewStorage(conn)
|
|
if err != nil {
|
|
log.Fatalf("could not create storage: %v", err)
|
|
}
|
|
|
|
db.Seed(store, conn)
|
|
}
|