Cleanup dataclient pour cmd/api
Utiliser NewDataClientFromViper
This commit is contained in:
parent
412727bf9c
commit
883edccf87
1 changed files with 1 additions and 9 deletions
10
cmd/api.go
10
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)
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue