diff --git a/Dockerfile b/Dockerfile index a9bf52d..ea6e9a3 100644 --- a/Dockerfile +++ b/Dockerfile @@ -1,4 +1,4 @@ -FROM golang:1.20.4 as build +FROM golang:1.21.4 as build LABEL author="vlbeaudoin" diff --git a/cmd/api.go b/cmd/api.go index 2aa156b..5f11779 100644 --- a/cmd/api.go +++ b/cmd/api.go @@ -4,6 +4,7 @@ import ( "crypto/subtle" "fmt" "log" + "net/http" "git.agecem.com/agecem/bottin-agenda/data" "git.agecem.com/agecem/bottin-agenda/handlers" @@ -34,8 +35,12 @@ var apiCmd = &cobra.Command{ bottinApiProtocol := viper.GetString("bottin.api.protocol") bottinApiPort := viper.GetInt("bottin.api.port") + bottinClient := http.DefaultClient + defer bottinClient.CloseIdleConnections() + // Using bottin's API client bottinConnection := bottindata.NewApiClient( + bottinClient, bottinApiKey, bottinApiHost, bottinApiProtocol, diff --git a/docker-compose.yaml b/docker-compose.yaml index 309d27f..f1f7c4f 100644 --- a/docker-compose.yaml +++ b/docker-compose.yaml @@ -1,7 +1,7 @@ services: db: - image: 'docker.io/library/postgres:14.8' + image: 'docker.io/library/postgres:16.1' environment: POSTGRES_DATABASE: "${BOTTINAGENDA_POSTGRES_DATABASE}" POSTGRES_PASSWORD: "${BOTTINAGENDA_POSTGRES_PASSWORD}" diff --git a/handlers/health.go b/handlers/health.go index f193544..1d6d3c5 100644 --- a/handlers/health.go +++ b/handlers/health.go @@ -19,7 +19,11 @@ func GetHealth(c echo.Context) error { bottinApiProtocol := viper.GetString("bottin.api.protocol") bottinApiPort := viper.GetInt("bottin.api.port") + bottinClient := http.DefaultClient + defer bottinClient.CloseIdleConnections() + bottinConnection := bottindata.NewApiClient( + bottinClient, bottinApiKey, bottinApiHost, bottinApiProtocol, diff --git a/handlers/transaction.go b/handlers/transaction.go index c6c6a15..946f6c8 100644 --- a/handlers/transaction.go +++ b/handlers/transaction.go @@ -80,8 +80,12 @@ func PostTransactions(c echo.Context) error { bottinApiProtocol := viper.GetString("bottin.api.protocol") bottinApiPort := viper.GetInt("bottin.api.port") + bottinClient := http.DefaultClient + defer bottinClient.CloseIdleConnections() + // Using bottin's API client bottinApiClient := bottindata.NewApiClient( + bottinClient, bottinApiKey, bottinApiHost, bottinApiProtocol,