feature/dev-prepare-for-release_1 #1
@ -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()
|
||||
|
Loading…
Reference in New Issue
Block a user