package main import ( "log" "time" "midnadimple.com/fog/internal/db" "midnadimple.com/fog/internal/env" "midnadimple.com/fog/internal/store/postgres" ) func main() { cfg := config{ addr: env.GetString("FOG_ADDR", ":8080"), db: dbConfig{ addr: env.GetString("FOG_DB_ADDR", "postgres://foguser:fogpass@localhost/fog?sslmode=disable"), maxOpenConns: env.GetInt("FOG_DB_MAX_OPEN_CONNS", 30), maxIdleConns: env.GetInt("FOG_DB_MAX_IDLE_CONNS", 30), maxIdleTime: env.GetDuration("FOG_DB_MAX_IDLE_TIME", 15*time.Minute), }, } db, err := db.New( cfg.db.addr, cfg.db.maxOpenConns, cfg.db.maxIdleConns, cfg.db.maxIdleTime, ) if err != nil { log.Fatalln(err) } store := postgres.NewPostgresStorage(db) app := &application{ config: cfg, store: store, } log.Fatal(app.run()) }