Appeler config.GetConfig dans apiCmd

This commit is contained in:
Victor Lacasse-Beaudoin 2023-09-15 16:15:32 -04:00
parent 2bdb22d956
commit 3ba1231723

View file

@ -5,7 +5,9 @@ package cmd
import ( import (
"fmt" "fmt"
"log"
"git.agecem.com/agecem/bottin-ag/config"
"github.com/spf13/cobra" "github.com/spf13/cobra"
) )
@ -14,7 +16,13 @@ var apiCmd = &cobra.Command{
Use: "api", Use: "api",
Short: "Start the API server", Short: "Start the API server",
Run: func(cmd *cobra.Command, args []string) { Run: func(cmd *cobra.Command, args []string) {
fmt.Println("api called") cfg, err := config.GetConfig()
if err != nil {
log.Fatal(err)
}
fmt.Println("api called with api-port", cfg.API.Port)
fmt.Println("api called with web-port", cfg.Web.Port)
}, },
} }