From 883edccf8703628f9dd4723f9ae086f72f3809ef Mon Sep 17 00:00:00 2001 From: Victor Lacasse-Beaudoin Date: Fri, 2 Jun 2023 16:16:18 -0400 Subject: [PATCH] Cleanup dataclient pour cmd/api Utiliser NewDataClientFromViper --- cmd/api.go | 10 +--------- 1 file changed, 1 insertion(+), 9 deletions(-) diff --git a/cmd/api.go b/cmd/api.go index f1988b6..a7317b1 100644 --- a/cmd/api.go +++ b/cmd/api.go @@ -27,14 +27,6 @@ var apiCmd = &cobra.Command{ apiKey = viper.GetString("api.key") apiPort = viper.GetInt("api.port") - connection := data.PostgresConnection{ - User: viper.GetString("db.user"), - Password: viper.GetString("db.password"), - Host: viper.GetString("db.host"), - Database: viper.GetString("db.database"), - Port: viper.GetInt("db.port"), - } - e := echo.New() // Middlewares @@ -63,7 +55,7 @@ var apiCmd = &cobra.Command{ // Execution - client, err := data.NewDataClient(connection) + client, err := data.NewDataClientFromViper() if err != nil { log.Fatalf("Could not establish database connection.\n Error: %s\n", err) }