From ea49f1609ffbce4fd4d37e57c5a1cb1402cdeb3c Mon Sep 17 00:00:00 2001 From: Victor Lacasse-Beaudoin Date: Sat, 16 Sep 2023 18:16:32 -0400 Subject: [PATCH 1/3] =?UTF-8?q?Impl=C3=A9menter=20cfg.Bottin.API.Host?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- cmd/api.go | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/cmd/api.go b/cmd/api.go index d0e5c5b..36bfedc 100644 --- a/cmd/api.go +++ b/cmd/api.go @@ -32,7 +32,7 @@ var apiCmd = &cobra.Command{ v0 := e.Group("/v0") - bottinApiClient := bottindata.NewApiClient("bottin", "localhost", "http", 1312) + bottinApiClient := bottindata.NewApiClient("bottin", cfg.Bottin.API.Host, "http", 1312) dbClient, err := dbclient.New("db", "bottinag", "bottinag", "bottinag", 5432, false) if err != nil { From 9b6dd055efc060f4722d4f04a299b40110df6091 Mon Sep 17 00:00:00 2001 From: Victor Lacasse-Beaudoin Date: Sat, 16 Sep 2023 18:18:19 -0400 Subject: [PATCH 2/3] =?UTF-8?q?Ajouter=20et=20impl=C3=A9menter=20cfg.Botti?= =?UTF-8?q?n.API.Key?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- cmd/api.go | 2 +- config/config.go | 7 +++++++ 2 files changed, 8 insertions(+), 1 deletion(-) diff --git a/cmd/api.go b/cmd/api.go index 36bfedc..bb20834 100644 --- a/cmd/api.go +++ b/cmd/api.go @@ -32,7 +32,7 @@ var apiCmd = &cobra.Command{ v0 := e.Group("/v0") - bottinApiClient := bottindata.NewApiClient("bottin", cfg.Bottin.API.Host, "http", 1312) + bottinApiClient := bottindata.NewApiClient(cfg.Bottin.API.Key, cfg.Bottin.API.Host, "http", 1312) dbClient, err := dbclient.New("db", "bottinag", "bottinag", "bottinag", 5432, false) if err != nil { diff --git a/config/config.go b/config/config.go index 21ba7c0..66a9f57 100644 --- a/config/config.go +++ b/config/config.go @@ -22,6 +22,7 @@ type APIConfig struct { type BottinConfig struct { API struct { Host string + Key string } } @@ -69,6 +70,12 @@ func RegisterFlags(cmd *cobra.Command) error { return err } + // bottin.api.key + if err := RegisterString(cmd, true, + "bottin.api.key", "bottin-api-key", "Bottin API server key", "bottin"); err != nil { + return err + } + // web.port ; --web-port cmd.PersistentFlags().Int("web-port", 3183, "Webserver port") if err := viper.BindPFlag("web.port", cmd.PersistentFlags().Lookup("web-port")); err != nil { From 532c85f20045ff2b87efaeeb0172f5cb9d1992fb Mon Sep 17 00:00:00 2001 From: Victor Lacasse-Beaudoin Date: Sat, 16 Sep 2023 18:21:39 -0400 Subject: [PATCH 3/3] =?UTF-8?q?Ajouter=20et=20impl=C3=A9menter=20cfg.Botti?= =?UTF-8?q?n.API.Port=20et=20cfg.Bottin.API.Protocol?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- cmd/api.go | 2 +- config/config.go | 18 ++++++++++++++++-- 2 files changed, 17 insertions(+), 3 deletions(-) diff --git a/cmd/api.go b/cmd/api.go index bb20834..841b80f 100644 --- a/cmd/api.go +++ b/cmd/api.go @@ -32,7 +32,7 @@ var apiCmd = &cobra.Command{ v0 := e.Group("/v0") - bottinApiClient := bottindata.NewApiClient(cfg.Bottin.API.Key, cfg.Bottin.API.Host, "http", 1312) + bottinApiClient := bottindata.NewApiClient(cfg.Bottin.API.Key, cfg.Bottin.API.Host, cfg.Bottin.API.Protocol, cfg.Bottin.API.Port) dbClient, err := dbclient.New("db", "bottinag", "bottinag", "bottinag", 5432, false) if err != nil { diff --git a/config/config.go b/config/config.go index 66a9f57..6131b25 100644 --- a/config/config.go +++ b/config/config.go @@ -21,8 +21,10 @@ type APIConfig struct { type BottinConfig struct { API struct { - Host string - Key string + Host string + Key string + Port int + Protocol string } } @@ -76,6 +78,18 @@ func RegisterFlags(cmd *cobra.Command) error { return err } + // bottin.api.port + if err := RegisterInt(cmd, true, + "bottin.api.port", "bottin-api-port", "Bottin API server port", 1312); err != nil { + return err + } + + // bottin.api.protocol + if err := RegisterString(cmd, true, + "bottin.api.protocol", "bottin-api-protocol", "Bottin API server protocol", "http"); err != nil { + return err + } + // web.port ; --web-port cmd.PersistentFlags().Int("web-port", 3183, "Webserver port") if err := viper.BindPFlag("web.port", cmd.PersistentFlags().Lookup("web-port")); err != nil {