[tag] v1 #2

Merged
keedosn merged 4 commits from develop into master 2022-06-19 14:49:21 +02:00
4 changed files with 21 additions and 4 deletions
Showing only changes of commit 39ed417398 - Show all commits

View File

@ -3,7 +3,6 @@ package main
import (
"context"
"git.pbiernat.dev/golang/rest-api-prototype/internal/app/database"
"log"
"net"
"os"
"os/signal"
@ -22,7 +21,7 @@ const (
func main() {
if config.ErrLoadingEnvs != nil {
log.Fatalln("Error loading .env file")
app.Panicf("Error loading .env file")
}
httpAddr := net.JoinHostPort(config.GetEnv("SERVER_IP", defHttpIp), config.GetEnv("SERVER_PORT", defHttpPort))
@ -30,7 +29,7 @@ func main() {
dbc, err := database.Connect(dbConnStr)
if err != nil {
log.Panicf("Unable to connect to database: %v\n", err)
app.Panicf("Unable to connect to database: %v\n", err)
}
env := &handler.Env{httpAddr, dbc}

2
go.mod
View File

@ -1,6 +1,6 @@
module git.pbiernat.dev/golang/rest-api-prototype
go 1.17
go 1.18
require (
github.com/go-ozzo/ozzo-validation v3.6.0+incompatible

16
internal/app/log.go Normal file
View File

@ -0,0 +1,16 @@
package app
import "log"
func Panic(v ...any) {
log.Panicln(Name + ":", v)
}
func Panicf(format string, v ...any) {
log.Panicf(Name + ": " + format, v...)
}
func Panicln(v ...any) {
v = append([]any{Name + ":"}, v...)
log.Panicln(v...)
}

View File

@ -15,6 +15,8 @@ import (
"git.pbiernat.dev/golang/rest-api-prototype/internal/app/handler"
)
const Name = "REST API Service"
type Server struct {
*http.Server
}