[tag] v1 #2

Merged
keedosn merged 4 commits from develop into master 2022-06-19 14:49:21 +02:00
Showing only changes of commit 316323587d - Show all commits

View File

@ -2,6 +2,7 @@ package main
import (
"context"
"git.pbiernat.dev/golang/rest-api-prototype/internal/app/database"
"log"
"net"
"os"
@ -16,7 +17,7 @@ import (
const (
defHttpIp = "127.0.0.1"
defHttpPort = "8080"
defDbUrl = "postgres://postgres:postgres@127.0.0.1:5432/Api" // FIXME use default container conf in future
defDbUrl = "postgres://postgres:postgres@127.0.0.1:5432/Api" // FIXME: use env
)
func main() {
@ -25,15 +26,14 @@ func main() {
}
httpAddr := net.JoinHostPort(config.GetEnv("SERVER_IP", defHttpIp), config.GetEnv("SERVER_PORT", defHttpPort))
// dbConnStr := config.GetEnv("DATABASE_URL", defDbUrl)
dbConnStr := config.GetEnv("DATABASE_URL", defDbUrl)
// dbc, err := database.Connect(dbConnStr)
// if err != nil {
// log.Panicf("Unable to connect to database: %v\n", err)
// }
dbc, err := database.Connect(dbConnStr)
if err != nil {
log.Panicf("Unable to connect to database: %v\n", err)
}
// env := &handler.Env{httpAddr, dbc}
env := &handler.Env{httpAddr, nil}
env := &handler.Env{httpAddr, dbc}
srv := app.NewServer(env)
go srv.Start()