From 85868ecd7fec3226d9ddc52ef542733b8eabcc5d Mon Sep 17 00:00:00 2001 From: Victor Lacasse-Beaudoin Date: Fri, 15 Sep 2023 13:19:02 -0400 Subject: [PATCH 01/55] Ajouter .gitignore --- .gitignore | 5 +++++ 1 file changed, 5 insertions(+) create mode 100644 .gitignore diff --git a/.gitignore b/.gitignore new file mode 100644 index 0000000..8a33a19 --- /dev/null +++ b/.gitignore @@ -0,0 +1,5 @@ +.env +*.pem +*.swp +*.swo +*.test From fb1a4dcb8d9d1d271b804bc549f4a26e3dc85b43 Mon Sep 17 00:00:00 2001 From: Victor Lacasse-Beaudoin Date: Fri, 15 Sep 2023 13:27:01 -0400 Subject: [PATCH 02/55] Ajouter fichier .env de test MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Ignorer seulement /.env et non tous les fichiers nommés .env -- Les valeurs utilisées sont celles en exemple dans README.md --- .gitignore | 3 ++- examples/test.env | 3 +++ 2 files changed, 5 insertions(+), 1 deletion(-) create mode 100644 examples/test.env diff --git a/.gitignore b/.gitignore index 8a33a19..e52cdbd 100644 --- a/.gitignore +++ b/.gitignore @@ -1,4 +1,5 @@ -.env +/.env + *.pem *.swp *.swo diff --git a/examples/test.env b/examples/test.env new file mode 100644 index 0000000..3135fc5 --- /dev/null +++ b/examples/test.env @@ -0,0 +1,3 @@ +BOTTINAG_POSTGRES_DATABASE=bottinag +BOTTINAG_POSTGRES_PASSWORD=bottinag +BOTTINAG_POSTGRES_USER=bottinag From ac20221ca35f69b67e85b646b369fb72e7296441 Mon Sep 17 00:00:00 2001 From: Victor Lacasse-Beaudoin Date: Fri, 15 Sep 2023 16:13:05 -0400 Subject: [PATCH 03/55] =?UTF-8?q?Ajouter=20d=C3=A9finitions=20de=20base=20?= =?UTF-8?q?=C3=A0=20config/?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Ajouter structs Config, APIConfig et WebConfig Ajouter GetConfig pour encapsuler viper.Unmarshal Ajouter RegisterFlags pour déclarer flags cobra et associations viper --- config/config.go | 40 ++++++++++++++++++++++++++++++++++++++++ 1 file changed, 40 insertions(+) diff --git a/config/config.go b/config/config.go index e69de29..e7698ea 100644 --- a/config/config.go +++ b/config/config.go @@ -0,0 +1,40 @@ +package config + +import ( + "github.com/spf13/cobra" + "github.com/spf13/viper" +) + +type Config struct { + API APIConfig + Web WebConfig +} + +type APIConfig struct { + Port int +} + +type WebConfig struct { + Port int +} + +func GetConfig() (cfg Config, err error) { + return cfg, viper.Unmarshal(&cfg) +} + +// RegisterFlags adds persistent flags necessary to the application to the specified *cobra.Command +func RegisterFlags(cmd *cobra.Command) error { + // api.port ; --api-port + cmd.PersistentFlags().Int("api-port", 3182, "API server port") + if err := viper.BindPFlag("api.port", cmd.PersistentFlags().Lookup("api-port")); 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 { + return err + } + + return nil +} From 2bdb22d956a5cd5e6e24a19d51c2d682c93272b4 Mon Sep 17 00:00:00 2001 From: Victor Lacasse-Beaudoin Date: Fri, 15 Sep 2023 16:15:07 -0400 Subject: [PATCH 04/55] Appeler config.RegisterFlags dans rootCmd --- cmd/root.go | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/cmd/root.go b/cmd/root.go index 3332c5c..d73c696 100644 --- a/cmd/root.go +++ b/cmd/root.go @@ -5,8 +5,10 @@ package cmd import ( "fmt" + "log" "os" + "git.agecem.com/agecem/bottin-ag/config" "github.com/spf13/cobra" "github.com/spf13/viper" ) @@ -30,6 +32,10 @@ func init() { cobra.OnInitialize(initConfig) rootCmd.PersistentFlags().StringVar(&cfgFile, "config", "", "config file (default is $HOME/.bottin-ag.yaml)") + + if err := config.RegisterFlags(rootCmd); err != nil { + log.Fatal(err) + } } // initConfig reads in config file and ENV variables if set. From 3ba12317232c6af4d1b2f61e2a12f5934fe4bf98 Mon Sep 17 00:00:00 2001 From: Victor Lacasse-Beaudoin Date: Fri, 15 Sep 2023 16:15:32 -0400 Subject: [PATCH 05/55] Appeler config.GetConfig dans apiCmd --- cmd/api.go | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/cmd/api.go b/cmd/api.go index 1cd3f14..e9779d0 100644 --- a/cmd/api.go +++ b/cmd/api.go @@ -5,7 +5,9 @@ package cmd import ( "fmt" + "log" + "git.agecem.com/agecem/bottin-ag/config" "github.com/spf13/cobra" ) @@ -14,7 +16,13 @@ var apiCmd = &cobra.Command{ Use: "api", Short: "Start the API server", 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) }, } From 8666705feb625b75494dbdc3cfd8306719222a59 Mon Sep 17 00:00:00 2001 From: Victor Lacasse-Beaudoin Date: Fri, 15 Sep 2023 16:28:17 -0400 Subject: [PATCH 06/55] Ajouter MIT license --- LICENSE | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/LICENSE b/LICENSE index e69de29..f166f48 100644 --- a/LICENSE +++ b/LICENSE @@ -0,0 +1,9 @@ +MIT License + +Copyright (c) 2023 AGECEM + +Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions: + +The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. From 2ad3fdf9cb505370ed2b6ea7a6fb4f0657bd8fe8 Mon Sep 17 00:00:00 2001 From: Victor Lacasse-Beaudoin Date: Fri, 15 Sep 2023 16:36:56 -0400 Subject: [PATCH 07/55] =?UTF-8?q?D=C3=A9marrer=20echo=20pour=20apiCmd=20et?= =?UTF-8?q?=20webCmd?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- cmd/api.go | 9 +++++++-- cmd/web.go | 15 ++++++++++++++- go.mod | 21 +++++++++++++++++---- go.sum | 52 ++++++++++++++++++++++++++++++++++++++++++++++++---- 4 files changed, 86 insertions(+), 11 deletions(-) diff --git a/cmd/api.go b/cmd/api.go index e9779d0..d75979d 100644 --- a/cmd/api.go +++ b/cmd/api.go @@ -8,6 +8,8 @@ import ( "log" "git.agecem.com/agecem/bottin-ag/config" + "github.com/labstack/echo/v4" + "github.com/labstack/echo/v4/middleware" "github.com/spf13/cobra" ) @@ -21,8 +23,11 @@ var apiCmd = &cobra.Command{ log.Fatal(err) } - fmt.Println("api called with api-port", cfg.API.Port) - fmt.Println("api called with web-port", cfg.Web.Port) + e := echo.New() + + e.Pre(middleware.AddTrailingSlash()) + + e.Start(fmt.Sprintf(":%d", cfg.API.Port)) }, } diff --git a/cmd/web.go b/cmd/web.go index 0853484..2a1fe01 100644 --- a/cmd/web.go +++ b/cmd/web.go @@ -5,7 +5,11 @@ package cmd import ( "fmt" + "log" + "git.agecem.com/agecem/bottin-ag/config" + "github.com/labstack/echo/v4" + "github.com/labstack/echo/v4/middleware" "github.com/spf13/cobra" ) @@ -14,7 +18,16 @@ var webCmd = &cobra.Command{ Use: "web", Short: "Start the webserver", Run: func(cmd *cobra.Command, args []string) { - fmt.Println("web called") + cfg, err := config.GetConfig() + if err != nil { + log.Fatal(err) + } + + e := echo.New() + + e.Pre(middleware.AddTrailingSlash()) + + e.Start(fmt.Sprintf(":%d", cfg.Web.Port)) }, } diff --git a/go.mod b/go.mod index fa7d732..be62ae4 100644 --- a/go.mod +++ b/go.mod @@ -2,22 +2,35 @@ module git.agecem.com/agecem/bottin-ag go 1.21.0 +require ( + github.com/labstack/echo/v4 v4.11.1 + github.com/spf13/cobra v1.7.0 + github.com/spf13/viper v1.16.0 +) + require ( github.com/fsnotify/fsnotify v1.6.0 // indirect + github.com/golang-jwt/jwt v3.2.2+incompatible // indirect github.com/hashicorp/hcl v1.0.0 // indirect github.com/inconshreveable/mousetrap v1.1.0 // indirect + github.com/labstack/gommon v0.4.0 // indirect github.com/magiconair/properties v1.8.7 // indirect + github.com/mattn/go-colorable v0.1.13 // indirect + github.com/mattn/go-isatty v0.0.19 // indirect github.com/mitchellh/mapstructure v1.5.0 // indirect github.com/pelletier/go-toml/v2 v2.0.8 // indirect github.com/spf13/afero v1.9.5 // indirect github.com/spf13/cast v1.5.1 // indirect - github.com/spf13/cobra v1.7.0 // indirect github.com/spf13/jwalterweatherman v1.1.0 // indirect github.com/spf13/pflag v1.0.5 // indirect - github.com/spf13/viper v1.16.0 // indirect github.com/subosito/gotenv v1.4.2 // indirect - golang.org/x/sys v0.8.0 // indirect - golang.org/x/text v0.9.0 // indirect + github.com/valyala/bytebufferpool v1.0.0 // indirect + github.com/valyala/fasttemplate v1.2.2 // indirect + golang.org/x/crypto v0.11.0 // indirect + golang.org/x/net v0.12.0 // indirect + golang.org/x/sys v0.10.0 // indirect + golang.org/x/text v0.11.0 // indirect + golang.org/x/time v0.3.0 // indirect gopkg.in/ini.v1 v1.67.0 // indirect gopkg.in/yaml.v3 v3.0.1 // indirect ) diff --git a/go.sum b/go.sum index a53f2be..0efdb98 100644 --- a/go.sum +++ b/go.sum @@ -48,6 +48,7 @@ github.com/cncf/udpa/go v0.0.0-20200629203442-efcf912fb354/go.mod h1:WmhPx2Nbnht github.com/cncf/udpa/go v0.0.0-20201120205902-5459f2c99403/go.mod h1:WmhPx2Nbnhtbo57+VJT5O0JRkEi1Wbu0z5j0R8u5Hbk= github.com/cpuguy83/go-md2man/v2 v2.0.2/go.mod h1:tgQtvFlXSQOSOSIRvRPT7W67SCa46tRHOmNcaadrF8o= github.com/davecgh/go-spew v1.1.0/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38= +github.com/davecgh/go-spew v1.1.1 h1:vj9j/u1bqnvCEfJOwUhtlOARqs3+rkHYY13jYWTU97c= github.com/davecgh/go-spew v1.1.1/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38= github.com/envoyproxy/go-control-plane v0.9.0/go.mod h1:YTl/9mNaCwkRvm6d1a2C3ymFceY/DCBVvsKhRF0iEA4= github.com/envoyproxy/go-control-plane v0.9.1-0.20191026205805-5f8ba28d4473/go.mod h1:YTl/9mNaCwkRvm6d1a2C3ymFceY/DCBVvsKhRF0iEA4= @@ -55,11 +56,15 @@ github.com/envoyproxy/go-control-plane v0.9.4/go.mod h1:6rpuAdCZL397s3pYoYcLgu1m github.com/envoyproxy/go-control-plane v0.9.7/go.mod h1:cwu0lG7PUMfa9snN8LXBig5ynNVH9qI8YYLbd1fK2po= github.com/envoyproxy/go-control-plane v0.9.9-0.20201210154907-fd9021fe5dad/go.mod h1:cXg6YxExXjJnVBQHBLXeUAgxn2UodCpnH306RInaBQk= github.com/envoyproxy/protoc-gen-validate v0.1.0/go.mod h1:iSmxcyjqTsJpI2R4NaDN7+kN2VEUnK/pcBlmesArF7c= +github.com/frankban/quicktest v1.14.4 h1:g2rn0vABPOOXmZUj+vbmUp0lPoXEMuhTpIluN0XL9UY= +github.com/frankban/quicktest v1.14.4/go.mod h1:4ptaffx2x8+WTWXmUCuVU6aPUX1/Mz7zb5vbUoiM6w0= github.com/fsnotify/fsnotify v1.6.0 h1:n+5WquG0fcWoWp6xPWfHdbskMCQaFnG6PfBrh1Ky4HY= github.com/fsnotify/fsnotify v1.6.0/go.mod h1:sl3t1tCWJFWoRz9R8WJCbQihKKwmorjAbSClcnxKAGw= github.com/go-gl/glfw v0.0.0-20190409004039-e6da0acd62b1/go.mod h1:vR7hzQXu2zJy9AVAgeJqvqgH9Q5CA+iKCZ2gyEVpxRU= github.com/go-gl/glfw/v3.3/glfw v0.0.0-20191125211704-12ad95a8df72/go.mod h1:tQ2UAYgL5IevRw8kRxooKSPJfGvJ9fJQFa0TUsXzTg8= github.com/go-gl/glfw/v3.3/glfw v0.0.0-20200222043503-6f7a984d4dc4/go.mod h1:tQ2UAYgL5IevRw8kRxooKSPJfGvJ9fJQFa0TUsXzTg8= +github.com/golang-jwt/jwt v3.2.2+incompatible h1:IfV12K8xAKAnZqdXVzCZ+TOjboZ2keLg81eXfW3O+oY= +github.com/golang-jwt/jwt v3.2.2+incompatible/go.mod h1:8pz2t5EyA70fFQQSrl6XZXzqecmYZeUEB8OUGHkxJ+I= github.com/golang/glog v0.0.0-20160126235308-23def4e6c14b/go.mod h1:SBH7ygxi8pfUlaOkMMuAQtPIUF8ecWP5IEl/CR7VP2Q= github.com/golang/groupcache v0.0.0-20190702054246-869f871628b6/go.mod h1:cIg4eruTrX1D+g88fzRXU5OdNfaM+9IcxsU14FzY7Hc= github.com/golang/groupcache v0.0.0-20191227052852-215e87163ea7/go.mod h1:cIg4eruTrX1D+g88fzRXU5OdNfaM+9IcxsU14FzY7Hc= @@ -96,6 +101,8 @@ github.com/google/go-cmp v0.5.0/go.mod h1:v8dTdLbMG2kIc/vJvl+f65V22dbkXbowE6jgT/ github.com/google/go-cmp v0.5.1/go.mod h1:v8dTdLbMG2kIc/vJvl+f65V22dbkXbowE6jgT/gNBxE= github.com/google/go-cmp v0.5.2/go.mod h1:v8dTdLbMG2kIc/vJvl+f65V22dbkXbowE6jgT/gNBxE= github.com/google/go-cmp v0.5.4/go.mod h1:v8dTdLbMG2kIc/vJvl+f65V22dbkXbowE6jgT/gNBxE= +github.com/google/go-cmp v0.5.9 h1:O2Tfq5qg4qc4AmwVlvv0oLiVAGB7enBSJ2x2DqQFi38= +github.com/google/go-cmp v0.5.9/go.mod h1:17dUlkBOakJ0+DkrSSNjCkIjxS6bF9zb3elmeNGIjoY= github.com/google/martian v2.1.0+incompatible/go.mod h1:9I4somxYTbIHy5NJKHRl3wXiIaQGbYVAs8BPL6v8lEs= github.com/google/martian/v3 v3.0.0/go.mod h1:y5Zk1BBys9G+gd6Jrk0W3cC1+ELVxBWuIGO+w/tUAp0= github.com/google/martian/v3 v3.1.0/go.mod h1:y5Zk1BBys9G+gd6Jrk0W3cC1+ELVxBWuIGO+w/tUAp0= @@ -127,19 +134,37 @@ github.com/jstemmer/go-junit-report v0.9.1/go.mod h1:Brl9GWCQeLvo8nXZwPNNblvFj/X github.com/kisielk/gotool v1.0.0/go.mod h1:XhKaO+MFFWcvkIS/tQcRk01m1F5IRFswLeQ+oQHNcck= github.com/kr/fs v0.1.0/go.mod h1:FFnZGqtBN9Gxj7eW1uZ42v5BccTP0vu6NEaFoC2HwRg= github.com/kr/pretty v0.1.0/go.mod h1:dAy3ld7l9f0ibDNOQOHHMYYIIbhfbHSm3C4ZsoJORNo= +github.com/kr/pretty v0.3.1 h1:flRD4NNwYAUpkphVc1HcthR4KEIFJ65n8Mw5qdRn3LE= +github.com/kr/pretty v0.3.1/go.mod h1:hoEshYVHaxMs3cyo3Yncou5ZscifuDolrwPKZanG3xk= github.com/kr/pty v1.1.1/go.mod h1:pFQYn66WHrOpPYNljwOMqo10TkYh1fy3cYio2l3bCsQ= github.com/kr/text v0.1.0/go.mod h1:4Jbv+DJW3UT/LiOwJeYQe1efqtUx/iVham/4vfdArNI= +github.com/kr/text v0.2.0 h1:5Nx0Ya0ZqY2ygV366QzturHI13Jq95ApcVaJBhpS+AY= +github.com/kr/text v0.2.0/go.mod h1:eLer722TekiGuMkidMxC/pM04lWEeraHUUmBw8l2grE= +github.com/labstack/echo/v4 v4.11.1 h1:dEpLU2FLg4UVmvCGPuk/APjlH6GDpbEPti61srUUUs4= +github.com/labstack/echo/v4 v4.11.1/go.mod h1:YuYRTSM3CHs2ybfrL8Px48bO6BAnYIN4l8wSTMP6BDQ= +github.com/labstack/gommon v0.4.0 h1:y7cvthEAEbU0yHOf4axH8ZG2NH8knB9iNSoTO8dyIk8= +github.com/labstack/gommon v0.4.0/go.mod h1:uW6kP17uPlLJsD3ijUYn3/M5bAxtlZhMI6m3MFxTMTM= github.com/magiconair/properties v1.8.7 h1:IeQXZAiQcpL9mgcAe1Nu6cX9LLw6ExEHKjN0VQdvPDY= github.com/magiconair/properties v1.8.7/go.mod h1:Dhd985XPs7jluiymwWYZ0G4Z61jb3vdS329zhj2hYo0= +github.com/mattn/go-colorable v0.1.11/go.mod h1:u5H1YNBxpqRaxsYJYSkiCWKzEfiAb1Gb520KVy5xxl4= +github.com/mattn/go-colorable v0.1.13 h1:fFA4WZxdEF4tXPZVKMLwD8oUnCTTo08duU7wxecdEvA= +github.com/mattn/go-colorable v0.1.13/go.mod h1:7S9/ev0klgBDR4GtXTXX8a3vIGJpMovkB8vQcUbaXHg= +github.com/mattn/go-isatty v0.0.14/go.mod h1:7GGIvUiUoEMVVmxf/4nioHXj79iQHKdU27kJ6hsGG94= +github.com/mattn/go-isatty v0.0.16/go.mod h1:kYGgaQfpe5nmfYZH+SKPsOc2e4SrIfOl2e/yFXSvRLM= +github.com/mattn/go-isatty v0.0.19 h1:JITubQf0MOLdlGRuRq+jtsDlekdYPia9ZFsB8h/APPA= +github.com/mattn/go-isatty v0.0.19/go.mod h1:W+V8PltTTMOvKvAeJH7IuucS94S2C6jfK/D7dTCTo3Y= github.com/mitchellh/mapstructure v1.5.0 h1:jeMsZIYE/09sWLaz43PL7Gy6RuMjD2eJVyuac5Z2hdY= github.com/mitchellh/mapstructure v1.5.0/go.mod h1:bFUtVrKA4DC2yAKiSyO/QUcy7e+RRV2QTWOzhPopBRo= github.com/pelletier/go-toml/v2 v2.0.8 h1:0ctb6s9mE31h0/lhu+J6OPmVeDxJn+kYnJc2jZR9tGQ= github.com/pelletier/go-toml/v2 v2.0.8/go.mod h1:vuYfssBdrU2XDZ9bYydBu6t+6a6PYNcZljzZR9VXg+4= github.com/pkg/errors v0.9.1/go.mod h1:bwawxfHBFNV+L2hUp1rHADufV3IMtnDRdf1r5NINEl0= github.com/pkg/sftp v1.13.1/go.mod h1:3HaPG6Dq1ILlpPZRO0HVMrsydcdLt6HRDccSgb87qRg= +github.com/pmezard/go-difflib v1.0.0 h1:4DBwDE0NGyQoBHbLQYPwSUPoCMWR5BEzIk/f1lZbAQM= github.com/pmezard/go-difflib v1.0.0/go.mod h1:iKH77koFhYxTK1pcRnkKkqfTogsbg7gZNVY4sRDYZ/4= github.com/prometheus/client_model v0.0.0-20190812154241-14fe0d1b01d4/go.mod h1:xMI15A0UPsDsEKsMN9yxemIoYk6Tm2C1GtYGdfGttqA= github.com/rogpeppe/go-internal v1.3.0/go.mod h1:M8bDsm7K2OlrFYOpmOWEs/qY81heoFRclV5y23lUDJ4= +github.com/rogpeppe/go-internal v1.9.0 h1:73kH8U+JUqXU8lRuOHeVHaa/SZPifC7BkcraZVejAe8= +github.com/rogpeppe/go-internal v1.9.0/go.mod h1:WtVeX8xhTBvf0smdhujwtBcq4Qrzq/fJaraNFVN+nFs= github.com/russross/blackfriday/v2 v2.1.0/go.mod h1:+Rmxgy9KzJVeS9/2gXHxylqXiyQDYRxCVz55jmeOWTM= github.com/spf13/afero v1.9.5 h1:stMpOSZFs//0Lv29HduCmli3GUfpFoF3Y1Q/aXj/wVM= github.com/spf13/afero v1.9.5/go.mod h1:UBogFpq8E9Hx+xc5CNTTEpTnuHVmXDwZcZcE1eb/UhQ= @@ -162,9 +187,15 @@ github.com/stretchr/testify v1.5.1/go.mod h1:5W2xD1RspED5o8YsWQXVCued0rvSQ+mT+I5 github.com/stretchr/testify v1.7.0/go.mod h1:6Fq8oRcR53rry900zMqJjRRixrwX3KX962/h/Wwjteg= github.com/stretchr/testify v1.7.1/go.mod h1:6Fq8oRcR53rry900zMqJjRRixrwX3KX962/h/Wwjteg= github.com/stretchr/testify v1.8.0/go.mod h1:yNjHg4UonilssWZ8iaSj1OCr/vHnekPRkoO+kdMU+MU= +github.com/stretchr/testify v1.8.3 h1:RP3t2pwF7cMEbC1dqtB6poj3niw/9gnV4Cjg5oW5gtY= github.com/stretchr/testify v1.8.3/go.mod h1:sz/lmYIOXD/1dqDmKjjqLyZ2RngseejIcXlSw2iwfAo= github.com/subosito/gotenv v1.4.2 h1:X1TuBLAMDFbaTAChgCBLu3DU3UPyELpnF2jjJ2cz/S8= github.com/subosito/gotenv v1.4.2/go.mod h1:ayKnFf/c6rvx/2iiLrJUk1e6plDbT3edrFNGqEflhK0= +github.com/valyala/bytebufferpool v1.0.0 h1:GqA5TC/0021Y/b9FG4Oi9Mr3q7XYx6KllzawFIhcdPw= +github.com/valyala/bytebufferpool v1.0.0/go.mod h1:6bBcMArwyJ5K/AmCkWv1jt77kVWyCJ6HpOuEn7z0Csc= +github.com/valyala/fasttemplate v1.2.1/go.mod h1:KHLXt3tVN2HBp8eijSv/kGJopbvo7S+qRAEEKiv+SiQ= +github.com/valyala/fasttemplate v1.2.2 h1:lxLXG0uE3Qnshl9QyaK6XJxMXlQZELvChBOCmQD0Loo= +github.com/valyala/fasttemplate v1.2.2/go.mod h1:KHLXt3tVN2HBp8eijSv/kGJopbvo7S+qRAEEKiv+SiQ= github.com/yuin/goldmark v1.1.25/go.mod h1:3hX8gzYuyVAZsxl0MRgGTJEmQBFcNTphYh9decYSb74= github.com/yuin/goldmark v1.1.27/go.mod h1:3hX8gzYuyVAZsxl0MRgGTJEmQBFcNTphYh9decYSb74= github.com/yuin/goldmark v1.1.32/go.mod h1:3hX8gzYuyVAZsxl0MRgGTJEmQBFcNTphYh9decYSb74= @@ -182,6 +213,8 @@ golang.org/x/crypto v0.0.0-20191011191535-87dc89f01550/go.mod h1:yigFU9vqHzYiE8U golang.org/x/crypto v0.0.0-20200622213623-75b288015ac9/go.mod h1:LzIPMQfyMNhhGPhUkYOs5KpL4U8rLKemX1yGLhDgUto= golang.org/x/crypto v0.0.0-20210421170649-83a5a9bb288b/go.mod h1:T9bdIzuCu7OtxOm1hfPfRQxPLYneinmdGuTeoZ9dtd4= golang.org/x/crypto v0.0.0-20220722155217-630584e8d5aa/go.mod h1:IxCIyHEi3zRg3s0A5j5BB6A9Jmi73HwBIUl50j+osU4= +golang.org/x/crypto v0.11.0 h1:6Ewdq3tDic1mg5xRO4milcWCfMVQhI4NkqWWvqejpuA= +golang.org/x/crypto v0.11.0/go.mod h1:xgJhtzW8F9jGdVFWZESrid1U1bjeNy4zgy5cRr/CIio= golang.org/x/exp v0.0.0-20190121172915-509febef88a4/go.mod h1:CJ0aWSM057203Lf6IL+f9T1iT9GByDxfZKAQTCR3kQA= golang.org/x/exp v0.0.0-20190306152737-a1d7652674e8/go.mod h1:CJ0aWSM057203Lf6IL+f9T1iT9GByDxfZKAQTCR3kQA= golang.org/x/exp v0.0.0-20190510132918-efd6b22b2522/go.mod h1:ZjyILWgesfNpC6sMxTJOJm9Kp84zZh5NQWvqDGG3Qr8= @@ -247,6 +280,8 @@ golang.org/x/net v0.0.0-20201209123823-ac852fbbde11/go.mod h1:m0MpNAwzfU5UDzcl9v golang.org/x/net v0.0.0-20201224014010-6772e930b67b/go.mod h1:m0MpNAwzfU5UDzcl9v0D8zg8gWTRqZa9RBIspLL5mdg= golang.org/x/net v0.0.0-20210226172049-e18ecbb05110/go.mod h1:m0MpNAwzfU5UDzcl9v0D8zg8gWTRqZa9RBIspLL5mdg= golang.org/x/net v0.0.0-20211112202133-69e39bad7dc2/go.mod h1:9nx3DQGgdP8bBQD5qxJ1jj9UTztislL4KSBs9R2vV5Y= +golang.org/x/net v0.12.0 h1:cfawfvKITfUsFCeJIHJrbSxpeu/E81khclypR0GVT50= +golang.org/x/net v0.12.0/go.mod h1:zEVYFnQC7m/vmpQFELhcD1EWkZlX69l4oqgmer6hfKA= golang.org/x/oauth2 v0.0.0-20180821212333-d2e6202438be/go.mod h1:N/0e6XlmueqKjAGxoOufVs8QHGRruUQn6yWY3a++T0U= golang.org/x/oauth2 v0.0.0-20190226205417-e64efc72b421/go.mod h1:gOpvHmFTYa4IltrdGE7lF6nIHvwfUNPOp7c8zoXwtLw= golang.org/x/oauth2 v0.0.0-20190604053449-0f29369cfe45/go.mod h1:gOpvHmFTYa4IltrdGE7lF6nIHvwfUNPOp7c8zoXwtLw= @@ -301,9 +336,14 @@ golang.org/x/sys v0.0.0-20210225134936-a50acf3fe073/go.mod h1:h1NjWce9XRLGQEsW7w golang.org/x/sys v0.0.0-20210423082822-04245dca01da/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= golang.org/x/sys v0.0.0-20210423185535-09eb48e85fd7/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= golang.org/x/sys v0.0.0-20210615035016-665e8c7367d1/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= +golang.org/x/sys v0.0.0-20210630005230-0f9fa26af87c/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= +golang.org/x/sys v0.0.0-20210927094055-39ccf1dd6fa6/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= +golang.org/x/sys v0.0.0-20211103235746-7861aae1554b/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= +golang.org/x/sys v0.0.0-20220811171246-fbc7d0a398ab/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= golang.org/x/sys v0.0.0-20220908164124-27713097b956/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= -golang.org/x/sys v0.8.0 h1:EBmGv8NaZBZTWvrbjNoL6HVt+IVy3QDQpJs7VRIw3tU= -golang.org/x/sys v0.8.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= +golang.org/x/sys v0.6.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= +golang.org/x/sys v0.10.0 h1:SqMFp9UcQJZa+pmYuAKjd9xq1f0j5rLcDIk0mj4qAsA= +golang.org/x/sys v0.10.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= golang.org/x/term v0.0.0-20201126162022-7de9c90e9dd1/go.mod h1:bj7SfCRtBDWHUb9snDiAeCFNEtKQo2Wmx5Cou7ajbmo= golang.org/x/text v0.0.0-20170915032832-14c0d48ead0c/go.mod h1:NqM8EUOU14njkJ3fqMW+pc6Ldnwhi/IjpwHt7yyuwOQ= golang.org/x/text v0.3.0/go.mod h1:NqM8EUOU14njkJ3fqMW+pc6Ldnwhi/IjpwHt7yyuwOQ= @@ -313,11 +353,13 @@ golang.org/x/text v0.3.3/go.mod h1:5Zoc/QRtKVWzQhOtBMvqHzDpF6irO9z98xDceosuGiQ= golang.org/x/text v0.3.4/go.mod h1:5Zoc/QRtKVWzQhOtBMvqHzDpF6irO9z98xDceosuGiQ= golang.org/x/text v0.3.6/go.mod h1:5Zoc/QRtKVWzQhOtBMvqHzDpF6irO9z98xDceosuGiQ= golang.org/x/text v0.3.7/go.mod h1:u+2+/6zg+i71rQMx5EYifcz6MCKuco9NR6JIITiCfzQ= -golang.org/x/text v0.9.0 h1:2sjJmO8cDvYveuX97RDLsxlyUxLl+GHoLxBiRdHllBE= -golang.org/x/text v0.9.0/go.mod h1:e1OnstbJyHTd6l/uOt8jFFHp6TRDWZR/bV3emEE/zU8= +golang.org/x/text v0.11.0 h1:LAntKIrcmeSKERyiOh0XMV39LXS8IE9UL2yP7+f5ij4= +golang.org/x/text v0.11.0/go.mod h1:TvPlkZtksWOMsz7fbANvkp4WM8x/WCo/om8BMLbz+aE= golang.org/x/time v0.0.0-20181108054448-85acf8d2951c/go.mod h1:tRJNPiyCQ0inRvYxbN9jk5I+vvW/OXSQhTDSoE431IQ= golang.org/x/time v0.0.0-20190308202827-9d24e82272b4/go.mod h1:tRJNPiyCQ0inRvYxbN9jk5I+vvW/OXSQhTDSoE431IQ= golang.org/x/time v0.0.0-20191024005414-555d28b269f0/go.mod h1:tRJNPiyCQ0inRvYxbN9jk5I+vvW/OXSQhTDSoE431IQ= +golang.org/x/time v0.3.0 h1:rg5rLMjNzMS1RkNLzCG38eapWhnYLFYXDXj2gOlr8j4= +golang.org/x/time v0.3.0/go.mod h1:tRJNPiyCQ0inRvYxbN9jk5I+vvW/OXSQhTDSoE431IQ= golang.org/x/tools v0.0.0-20180917221912-90fa682c2a6e/go.mod h1:n7NCudcB/nEzxVGmLbDWY5pfWTLqBcC2KZ6jyYvM4mQ= golang.org/x/tools v0.0.0-20190114222345-bf090417da8b/go.mod h1:n7NCudcB/nEzxVGmLbDWY5pfWTLqBcC2KZ6jyYvM4mQ= golang.org/x/tools v0.0.0-20190226205152-f727befe758c/go.mod h1:9Yl7xja0Znq3iFh3HoIrodX9oNMXvdceNzlUR8zjMvY= @@ -458,12 +500,14 @@ google.golang.org/protobuf v1.23.1-0.20200526195155-81db48ad09cc/go.mod h1:EGpAD google.golang.org/protobuf v1.24.0/go.mod h1:r/3tXBNzIEhYS9I1OUVjXDlt8tc493IdKGjtUeSXeh4= google.golang.org/protobuf v1.25.0/go.mod h1:9JNX74DMeImyA3h4bdi1ymwjUzf21/xIlbajtzgsN7c= gopkg.in/check.v1 v0.0.0-20161208181325-20d25e280405/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0= +gopkg.in/check.v1 v1.0.0-20180628173108-788fd7840127 h1:qIbj1fsPNlZgppZ+VLlY7N33q108Sa+fhmuc+sWQYwY= gopkg.in/check.v1 v1.0.0-20180628173108-788fd7840127/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0= gopkg.in/errgo.v2 v2.1.0/go.mod h1:hNsd1EY+bozCKY1Ytp96fpM3vjJbqLJn88ws8XvfDNI= gopkg.in/ini.v1 v1.67.0 h1:Dgnx+6+nfE+IfzjUEISNeydPJh9AXNNsWbGP9KzCsOA= gopkg.in/ini.v1 v1.67.0/go.mod h1:pNLf8WUiyNEtQjuu5G5vTm06TEv9tsIgeAvK8hOrP4k= gopkg.in/yaml.v2 v2.2.2/go.mod h1:hI93XBmqTisBFMUTm0b8Fm+jr3Dg1NNxqwp+5A1VGuI= gopkg.in/yaml.v3 v3.0.0-20200313102051-9f266ea9e77c/go.mod h1:K4uyk7z7BCEPqu6E+C64Yfv1cQ7kz7rIZviUmN+EgEM= +gopkg.in/yaml.v3 v3.0.0-20210107192922-496545a6307b/go.mod h1:K4uyk7z7BCEPqu6E+C64Yfv1cQ7kz7rIZviUmN+EgEM= gopkg.in/yaml.v3 v3.0.1 h1:fxVm/GzAzEWqLHuvctI91KS9hhNmmWOoWu0XTYJS7CA= gopkg.in/yaml.v3 v3.0.1/go.mod h1:K4uyk7z7BCEPqu6E+C64Yfv1cQ7kz7rIZviUmN+EgEM= honnef.co/go/tools v0.0.0-20190102054323-c2f93a96b099/go.mod h1:rf3lG4BRIbNafJWhAfAdb/ePZxsR/4RtNHQocxwk9r4= From 6ef8eccbef4f6d49b8bba3e898a3a0293e1a2230 Mon Sep 17 00:00:00 2001 From: Victor Lacasse-Beaudoin Date: Fri, 15 Sep 2023 17:10:57 -0400 Subject: [PATCH 08/55] Refondre noms de package selon bonnes pratiques --- apiclient/apiclient.go | 2 ++ apihandler/apihandler.go | 2 ++ apiresponse/apiresponse.go | 2 ++ cmd/api.go | 2 +- cmd/root.go | 4 +--- cmd/web.go | 2 +- config/config.go | 6 +++++- data/data.go | 0 dbclient/dbclient.go | 2 ++ handlers/handlers.go | 0 main.go | 1 + models/models.go | 0 responses/responses.go | 0 templates/templates.go | 0 {templates => webcontent}/html/index.html | 0 webcontent/webcontent.go | 5 +++++ webhandler/webhandler.go | 2 ++ 17 files changed, 24 insertions(+), 6 deletions(-) create mode 100644 apiclient/apiclient.go create mode 100644 apihandler/apihandler.go create mode 100644 apiresponse/apiresponse.go delete mode 100644 data/data.go create mode 100644 dbclient/dbclient.go delete mode 100644 handlers/handlers.go delete mode 100644 models/models.go delete mode 100644 responses/responses.go delete mode 100644 templates/templates.go rename {templates => webcontent}/html/index.html (100%) create mode 100644 webcontent/webcontent.go create mode 100644 webhandler/webhandler.go diff --git a/apiclient/apiclient.go b/apiclient/apiclient.go new file mode 100644 index 0000000..2a74a7e --- /dev/null +++ b/apiclient/apiclient.go @@ -0,0 +1,2 @@ +// Package apiclient provides the API client used by the web app +package apiclient diff --git a/apihandler/apihandler.go b/apihandler/apihandler.go new file mode 100644 index 0000000..f96f1fc --- /dev/null +++ b/apihandler/apihandler.go @@ -0,0 +1,2 @@ +// Package apihandler provides handlers for API routes +package apihandler diff --git a/apiresponse/apiresponse.go b/apiresponse/apiresponse.go new file mode 100644 index 0000000..5b2b319 --- /dev/null +++ b/apiresponse/apiresponse.go @@ -0,0 +1,2 @@ +// Package apiresponse provides response types for API routes +package apiresponse diff --git a/cmd/api.go b/cmd/api.go index d75979d..c305bf1 100644 --- a/cmd/api.go +++ b/cmd/api.go @@ -18,7 +18,7 @@ var apiCmd = &cobra.Command{ Use: "api", Short: "Start the API server", Run: func(cmd *cobra.Command, args []string) { - cfg, err := config.GetConfig() + cfg, err := config.UnmarshalConfig() if err != nil { log.Fatal(err) } diff --git a/cmd/root.go b/cmd/root.go index d73c696..478df63 100644 --- a/cmd/root.go +++ b/cmd/root.go @@ -1,6 +1,4 @@ -/* -Copyright © 2023 AGECEM & Victor Lacasse-Beaudoin -*/ +// Package cmd provides the cobra command and subcommands for the application package cmd import ( diff --git a/cmd/web.go b/cmd/web.go index 2a1fe01..08c1286 100644 --- a/cmd/web.go +++ b/cmd/web.go @@ -18,7 +18,7 @@ var webCmd = &cobra.Command{ Use: "web", Short: "Start the webserver", Run: func(cmd *cobra.Command, args []string) { - cfg, err := config.GetConfig() + cfg, err := config.UnmarshalConfig() if err != nil { log.Fatal(err) } diff --git a/config/config.go b/config/config.go index e7698ea..3e80868 100644 --- a/config/config.go +++ b/config/config.go @@ -1,3 +1,7 @@ +/* +Package config provides types and methods for managing this application's +config options and flags +*/ package config import ( @@ -18,7 +22,7 @@ type WebConfig struct { Port int } -func GetConfig() (cfg Config, err error) { +func UnmarshalConfig() (cfg Config, err error) { return cfg, viper.Unmarshal(&cfg) } diff --git a/data/data.go b/data/data.go deleted file mode 100644 index e69de29..0000000 diff --git a/dbclient/dbclient.go b/dbclient/dbclient.go new file mode 100644 index 0000000..61c4d69 --- /dev/null +++ b/dbclient/dbclient.go @@ -0,0 +1,2 @@ +// Package dbclient provides the database client used by the API server +package dbclient diff --git a/handlers/handlers.go b/handlers/handlers.go deleted file mode 100644 index e69de29..0000000 diff --git a/main.go b/main.go index e63f34c..e56c64d 100644 --- a/main.go +++ b/main.go @@ -1,6 +1,7 @@ /* Copyright © 2023 AGECEM & Victor Lacasse-Beaudoin +Application de registre de présences en Assemblée Générale de l'AGECEM */ package main diff --git a/models/models.go b/models/models.go deleted file mode 100644 index e69de29..0000000 diff --git a/responses/responses.go b/responses/responses.go deleted file mode 100644 index e69de29..0000000 diff --git a/templates/templates.go b/templates/templates.go deleted file mode 100644 index e69de29..0000000 diff --git a/templates/html/index.html b/webcontent/html/index.html similarity index 100% rename from templates/html/index.html rename to webcontent/html/index.html diff --git a/webcontent/webcontent.go b/webcontent/webcontent.go new file mode 100644 index 0000000..462e56d --- /dev/null +++ b/webcontent/webcontent.go @@ -0,0 +1,5 @@ +/* +Package webcontent provides the content to be embedded in the binary executable +for the web app +*/ +package webcontent diff --git a/webhandler/webhandler.go b/webhandler/webhandler.go new file mode 100644 index 0000000..56f4475 --- /dev/null +++ b/webhandler/webhandler.go @@ -0,0 +1,2 @@ +// Package webhandler provides handlers for the web app routes +package webhandler From dc72748fbe24decb749710c7cfaa4eabee799731 Mon Sep 17 00:00:00 2001 From: Victor Lacasse-Beaudoin Date: Fri, 15 Sep 2023 18:13:48 -0400 Subject: [PATCH 09/55] =?UTF-8?q?Impl=C3=A9menter=20route=20/v0/health?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Ajouter error type si dbclient ou bottinclient ne sont pas implémentés Ajouter echo.Group v0 --- apierror/apierror.go | 8 +++++++ apihandler/apihandler.go | 45 ++++++++++++++++++++++++++++++++++++++ apiresponse/apiresponse.go | 16 ++++++++++++++ cmd/api.go | 7 ++++++ 4 files changed, 76 insertions(+) create mode 100644 apierror/apierror.go diff --git a/apierror/apierror.go b/apierror/apierror.go new file mode 100644 index 0000000..daea8b0 --- /dev/null +++ b/apierror/apierror.go @@ -0,0 +1,8 @@ +// Package apierror defines error types that can be returned by the API server +package apierror + +type ErrBottinOrDBNotImplemented struct{} + +func (e *ErrBottinOrDBNotImplemented) Error() string { + return "Database client or agecem/bottin API client not implemented" +} diff --git a/apihandler/apihandler.go b/apihandler/apihandler.go index f96f1fc..f05fee6 100644 --- a/apihandler/apihandler.go +++ b/apihandler/apihandler.go @@ -1,2 +1,47 @@ // Package apihandler provides handlers for API routes package apihandler + +import ( + "net/http" + + "git.agecem.com/agecem/bottin-ag/apierror" + "git.agecem.com/agecem/bottin-ag/apiresponse" + "github.com/labstack/echo/v4" +) + +// DeclareRoutes declares the API server endpoints for the specified Group +func DeclareRoutes(e *echo.Group, h *APIHandler) { + e.GET("/health/", h.HealthGET) +} + +func New() (handler *APIHandler) { + return +} + +/* +APIHandler is the struct that implements the actual logic for the API server +routes +*/ +type APIHandler struct{} + +// HealthGET is the handler for `GET /v:version/health/ http/1.1` +func (a *APIHandler) HealthGET(c echo.Context) error { + var r apiresponse.HealthGET + + // TODO + r.Data.BottinStatus = "not implemented" + + // TODO + r.Data.DBStatus = "not implemented" + + if r.Data.BottinStatus == "not implemented" || r.Data.DBStatus == "not implemented" { + var err apierror.ErrBottinOrDBNotImplemented + r.Error = err.Error() + r.StatusCode = http.StatusInternalServerError + r.Message = "not ok" + + return c.JSON(r.StatusCode, r) + } + + return c.JSON(r.StatusCode, r) +} diff --git a/apiresponse/apiresponse.go b/apiresponse/apiresponse.go index 5b2b319..9d454d4 100644 --- a/apiresponse/apiresponse.go +++ b/apiresponse/apiresponse.go @@ -1,2 +1,18 @@ // Package apiresponse provides response types for API routes package apiresponse + +// Response defines the basic response types fields +type Response struct { + Error string + Message string + StatusCode int +} + +// HealthGET is the response type for `GET /v:version/health/ http/1.1` +type HealthGET struct { + Response + Data struct { + BottinStatus string + DBStatus string + } +} diff --git a/cmd/api.go b/cmd/api.go index c305bf1..023801e 100644 --- a/cmd/api.go +++ b/cmd/api.go @@ -7,6 +7,7 @@ import ( "fmt" "log" + "git.agecem.com/agecem/bottin-ag/apihandler" "git.agecem.com/agecem/bottin-ag/config" "github.com/labstack/echo/v4" "github.com/labstack/echo/v4/middleware" @@ -27,6 +28,12 @@ var apiCmd = &cobra.Command{ e.Pre(middleware.AddTrailingSlash()) + v0 := e.Group("/v0") + + handler := apihandler.New() + + apihandler.DeclareRoutes(v0, handler) + e.Start(fmt.Sprintf(":%d", cfg.API.Port)) }, } From 2bae4f5312b3d1ff7ac520d6c6089e6f5a672d2b Mon Sep 17 00:00:00 2001 From: Victor Lacasse-Beaudoin Date: Fri, 15 Sep 2023 18:16:39 -0400 Subject: [PATCH 10/55] =?UTF-8?q?Update=20Dockerfile=20avec=20packages=20p?= =?UTF-8?q?r=C3=A9sents?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- Dockerfile | 12 +++++++----- 1 file changed, 7 insertions(+), 5 deletions(-) diff --git a/Dockerfile b/Dockerfile index b799bef..3e11ae5 100644 --- a/Dockerfile +++ b/Dockerfile @@ -6,13 +6,15 @@ WORKDIR /go/src/app COPY go.mod go.sum main.go ./ +ADD apiclient/ apiclient/ +ADD apierror/ apierror/ +ADD apihandler/ apihandler/ +ADD apiresponse/ apiresponse/ ADD cmd/ cmd/ ADD config/ config/ -ADD data/ data/ -ADD handlers/ handlers/ -ADD models/ models/ -ADD responses/ responses/ -ADD templates/ templates/ +ADD dbclient/ dbclient/ +ADD webcontent/ webcontent/ +ADD webhandler/ webhandler/ RUN CGO_ENABLED=0 go build -a -installsuffix cgo -o bottin-ag . From 309942921d242deebec5792152a5846b3b45b329 Mon Sep 17 00:00:00 2001 From: Victor Lacasse-Beaudoin Date: Sat, 16 Sep 2023 15:05:13 -0400 Subject: [PATCH 11/55] Ajouter apihandler.ScanGET MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Ajouter *bottin.Data#ApiClient à APIHandler Implémenter BottinStatus dans apihandler.HealthGET --- apihandler/apihandler.go | 57 +++++++++++++++++++++++++++++++++++--- apiresponse/apiresponse.go | 8 ++++++ cmd/api.go | 8 +++++- go.mod | 4 +++ go.sum | 21 ++++++++++++++ 5 files changed, 93 insertions(+), 5 deletions(-) diff --git a/apihandler/apihandler.go b/apihandler/apihandler.go index f05fee6..a485de9 100644 --- a/apihandler/apihandler.go +++ b/apihandler/apihandler.go @@ -2,19 +2,22 @@ package apihandler import ( + "fmt" "net/http" "git.agecem.com/agecem/bottin-ag/apierror" "git.agecem.com/agecem/bottin-ag/apiresponse" + bottindata "git.agecem.com/agecem/bottin/v5/data" "github.com/labstack/echo/v4" ) // DeclareRoutes declares the API server endpoints for the specified Group func DeclareRoutes(e *echo.Group, h *APIHandler) { e.GET("/health/", h.HealthGET) + e.GET("/scan/:membre_id/", h.ScanGET) } -func New() (handler *APIHandler) { +func New() (handler APIHandler) { return } @@ -22,14 +25,22 @@ func New() (handler *APIHandler) { APIHandler is the struct that implements the actual logic for the API server routes */ -type APIHandler struct{} +type APIHandler struct { + BottinAPIClient *bottindata.ApiClient +} // HealthGET is the handler for `GET /v:version/health/ http/1.1` func (a *APIHandler) HealthGET(c echo.Context) error { var r apiresponse.HealthGET - // TODO - r.Data.BottinStatus = "not implemented" + bottinStatus, err := a.BottinAPIClient.GetHealth() + if err != nil { + r.Message = "not ok" + r.StatusCode = http.StatusInternalServerError + r.Data.BottinStatus = err.Error() + } else { + r.Data.BottinStatus = bottinStatus + } // TODO r.Data.DBStatus = "not implemented" @@ -45,3 +56,41 @@ func (a *APIHandler) HealthGET(c echo.Context) error { return c.JSON(r.StatusCode, r) } + +/* +ScanGET is the handler for `GET /v{version}/scan/{membre_id}/ http/1.1` + +It returns the scanned status of a membre, without affecting the database. +*/ +func (a *APIHandler) ScanGET(c echo.Context) error { + var r apiresponse.ScanGET + + r.StatusCode = http.StatusOK + + membreID := c.Param("membre_id") + + membre, err := a.BottinAPIClient.GetMembre(membreID) + if err != nil { + switch err.Error() { + case "Ce numéro étudiant ne correspond à aucunE membre": + r.Message = fmt.Sprintf("%s n'est pas membre de l'AGECEM", membreID) + r.StatusCode = http.StatusNotFound + case "Veuillez fournir un numéro étudiant à rechercher": + r.Error = "membre_id ne peut pas être vide" + r.StatusCode = http.StatusBadRequest + r.Message = err.Error() + default: + r.Error = err.Error() + r.Message = "Erreur lors de BottinAPIClient.GetMembre" + r.StatusCode = http.StatusInternalServerError + + return c.JSON(r.StatusCode, r) + } + } + + if membre.ID == membreID && membre.ID != "" { + r.Message = fmt.Sprintf("%s est membre de l'AGECEM", membreID) + } + + return c.JSON(r.StatusCode, r) +} diff --git a/apiresponse/apiresponse.go b/apiresponse/apiresponse.go index 9d454d4..619f240 100644 --- a/apiresponse/apiresponse.go +++ b/apiresponse/apiresponse.go @@ -16,3 +16,11 @@ type HealthGET struct { DBStatus string } } + +// ScanGET is the response type for `GET /v:version/scan/ http/1.1` +type ScanGET struct { + Response + Data struct { + IsScanned bool + } +} diff --git a/cmd/api.go b/cmd/api.go index 023801e..26f18ce 100644 --- a/cmd/api.go +++ b/cmd/api.go @@ -9,6 +9,7 @@ import ( "git.agecem.com/agecem/bottin-ag/apihandler" "git.agecem.com/agecem/bottin-ag/config" + bottindata "git.agecem.com/agecem/bottin/v5/data" "github.com/labstack/echo/v4" "github.com/labstack/echo/v4/middleware" "github.com/spf13/cobra" @@ -31,8 +32,13 @@ var apiCmd = &cobra.Command{ v0 := e.Group("/v0") handler := apihandler.New() + if &handler == nil { + log.Fatal("Newly created APIHandler is nil") + } - apihandler.DeclareRoutes(v0, handler) + handler.BottinAPIClient = bottindata.NewApiClient("bottin", "localhost", "http", 1312) + + apihandler.DeclareRoutes(v0, &handler) e.Start(fmt.Sprintf(":%d", cfg.API.Port)) }, diff --git a/go.mod b/go.mod index be62ae4..d9a5233 100644 --- a/go.mod +++ b/go.mod @@ -3,6 +3,7 @@ module git.agecem.com/agecem/bottin-ag go 1.21.0 require ( + git.agecem.com/agecem/bottin/v5 v5.3.0 github.com/labstack/echo/v4 v4.11.1 github.com/spf13/cobra v1.7.0 github.com/spf13/viper v1.16.0 @@ -13,12 +14,15 @@ require ( github.com/golang-jwt/jwt v3.2.2+incompatible // indirect github.com/hashicorp/hcl v1.0.0 // indirect github.com/inconshreveable/mousetrap v1.1.0 // indirect + github.com/jackc/pgx v3.6.2+incompatible // indirect + github.com/jmoiron/sqlx v1.3.5 // indirect github.com/labstack/gommon v0.4.0 // indirect github.com/magiconair/properties v1.8.7 // indirect github.com/mattn/go-colorable v0.1.13 // indirect github.com/mattn/go-isatty v0.0.19 // indirect github.com/mitchellh/mapstructure v1.5.0 // indirect github.com/pelletier/go-toml/v2 v2.0.8 // indirect + github.com/pkg/errors v0.9.1 // indirect github.com/spf13/afero v1.9.5 // indirect github.com/spf13/cast v1.5.1 // indirect github.com/spf13/jwalterweatherman v1.1.0 // indirect diff --git a/go.sum b/go.sum index 0efdb98..ee41114 100644 --- a/go.sum +++ b/go.sum @@ -36,6 +36,8 @@ cloud.google.com/go/storage v1.8.0/go.mod h1:Wv1Oy7z6Yz3DshWRJFhqM/UCfaWIRTdp0RX cloud.google.com/go/storage v1.10.0/go.mod h1:FLPqc6j+Ki4BU591ie1oL6qBQGu2Bl/tZ9ullr3+Kg0= cloud.google.com/go/storage v1.14.0/go.mod h1:GrKmX003DSIwi9o29oFT7YDnHYwZoctc3fOKtUw0Xmo= dmitri.shuralyov.com/gpu/mtl v0.0.0-20190408044501-666a987793e9/go.mod h1:H6x//7gZCb22OMCxBHrMx7a5I7Hp++hsVxbQ4BYO7hU= +git.agecem.com/agecem/bottin/v5 v5.3.0 h1:7Fb0nJaGbWO2q//nTTZcVqLJoVSw0Ov0IoCs7/6ja+o= +git.agecem.com/agecem/bottin/v5 v5.3.0/go.mod h1:r4ZZB7P0XL4ZCatD99LHCS9fkpjl0UFCasalYPEW0Hw= github.com/BurntSushi/toml v0.3.1/go.mod h1:xHWCNGjB5oqiDr8zfno3MHue2Ht5sIBksp03qcyfWMU= github.com/BurntSushi/xgb v0.0.0-20160522181843-27f122750802/go.mod h1:IVnqGOEym/WlBOVXweHU+Q+/VP0lqqI8lqeDx9IjBqo= github.com/census-instrumentation/opencensus-proto v0.2.1/go.mod h1:f6KPmirojxKA12rnyqOA5BBL4O983OfeGPqjHWSTneU= @@ -46,6 +48,8 @@ github.com/client9/misspell v0.3.4/go.mod h1:qj6jICC3Q7zFZvVWo7KLAzC3yx5G7kyvSDk github.com/cncf/udpa/go v0.0.0-20191209042840-269d4d468f6f/go.mod h1:M8M6+tZqaGXZJjfX53e64911xZQV5JYwmTeXPW+k8Sc= github.com/cncf/udpa/go v0.0.0-20200629203442-efcf912fb354/go.mod h1:WmhPx2Nbnhtbo57+VJT5O0JRkEi1Wbu0z5j0R8u5Hbk= github.com/cncf/udpa/go v0.0.0-20201120205902-5459f2c99403/go.mod h1:WmhPx2Nbnhtbo57+VJT5O0JRkEi1Wbu0z5j0R8u5Hbk= +github.com/cockroachdb/apd v1.1.0 h1:3LFP3629v+1aKXU5Q37mxmRxX/pIu1nijXydLShEq5I= +github.com/cockroachdb/apd v1.1.0/go.mod h1:8Sl8LxpKi29FqWXR16WEFZRNSz3SoPzUzeMeY4+DwBQ= github.com/cpuguy83/go-md2man/v2 v2.0.2/go.mod h1:tgQtvFlXSQOSOSIRvRPT7W67SCa46tRHOmNcaadrF8o= github.com/davecgh/go-spew v1.1.0/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38= github.com/davecgh/go-spew v1.1.1 h1:vj9j/u1bqnvCEfJOwUhtlOARqs3+rkHYY13jYWTU97c= @@ -63,6 +67,10 @@ github.com/fsnotify/fsnotify v1.6.0/go.mod h1:sl3t1tCWJFWoRz9R8WJCbQihKKwmorjAbS github.com/go-gl/glfw v0.0.0-20190409004039-e6da0acd62b1/go.mod h1:vR7hzQXu2zJy9AVAgeJqvqgH9Q5CA+iKCZ2gyEVpxRU= github.com/go-gl/glfw/v3.3/glfw v0.0.0-20191125211704-12ad95a8df72/go.mod h1:tQ2UAYgL5IevRw8kRxooKSPJfGvJ9fJQFa0TUsXzTg8= github.com/go-gl/glfw/v3.3/glfw v0.0.0-20200222043503-6f7a984d4dc4/go.mod h1:tQ2UAYgL5IevRw8kRxooKSPJfGvJ9fJQFa0TUsXzTg8= +github.com/go-sql-driver/mysql v1.6.0 h1:BCTh4TKNUYmOmMUcQ3IipzF5prigylS7XXjEkfCHuOE= +github.com/go-sql-driver/mysql v1.6.0/go.mod h1:DCzpHaOWr8IXmIStZouvnhqoel9Qv2LBy8hT2VhHyBg= +github.com/gofrs/uuid v4.4.0+incompatible h1:3qXRTX8/NbyulANqlc0lchS1gqAVxRgsuW1YrTJupqA= +github.com/gofrs/uuid v4.4.0+incompatible/go.mod h1:b2aQJv3Z4Fp6yNu3cdSllBxTCLRxnplIgP/c0N/04lM= github.com/golang-jwt/jwt v3.2.2+incompatible h1:IfV12K8xAKAnZqdXVzCZ+TOjboZ2keLg81eXfW3O+oY= github.com/golang-jwt/jwt v3.2.2+incompatible/go.mod h1:8pz2t5EyA70fFQQSrl6XZXzqecmYZeUEB8OUGHkxJ+I= github.com/golang/glog v0.0.0-20160126235308-23def4e6c14b/go.mod h1:SBH7ygxi8pfUlaOkMMuAQtPIUF8ecWP5IEl/CR7VP2Q= @@ -129,6 +137,12 @@ github.com/ianlancetaylor/demangle v0.0.0-20181102032728-5e5cf60278f6/go.mod h1: github.com/ianlancetaylor/demangle v0.0.0-20200824232613-28f6c0f3b639/go.mod h1:aSSvb/t6k1mPoxDqO4vJh6VOCGPwU4O0C2/Eqndh1Sc= github.com/inconshreveable/mousetrap v1.1.0 h1:wN+x4NVGpMsO7ErUn/mUI3vEoE6Jt13X2s0bqwp9tc8= github.com/inconshreveable/mousetrap v1.1.0/go.mod h1:vpF70FUmC8bwa3OWnCshd2FqLfsEA9PFc4w1p2J65bw= +github.com/jackc/fake v0.0.0-20150926172116-812a484cc733 h1:vr3AYkKovP8uR8AvSGGUK1IDqRa5lAAvEkZG1LKaCRc= +github.com/jackc/fake v0.0.0-20150926172116-812a484cc733/go.mod h1:WrMFNQdiFJ80sQsxDoMokWK1W5TQtxBFNpzWTD84ibQ= +github.com/jackc/pgx v3.6.2+incompatible h1:2zP5OD7kiyR3xzRYMhOcXVvkDZsImVXfj+yIyTQf3/o= +github.com/jackc/pgx v3.6.2+incompatible/go.mod h1:0ZGrqGqkRlliWnWB4zKnWtjbSWbGkVEFm4TeybAXq+I= +github.com/jmoiron/sqlx v1.3.5 h1:vFFPA71p1o5gAeqtEAwLU4dnX2napprKtHr7PYIcN3g= +github.com/jmoiron/sqlx v1.3.5/go.mod h1:nRVWtLre0KfCLJvgxzCsLVMogSvQ1zNJtpYr2Ccp0mQ= github.com/jstemmer/go-junit-report v0.0.0-20190106144839-af01ea7f8024/go.mod h1:6v2b51hI/fHJwM22ozAgKL4VKDeJcHhJFhtBdhmNjmU= github.com/jstemmer/go-junit-report v0.9.1/go.mod h1:Brl9GWCQeLvo8nXZwPNNblvFj/XSXhF0NWZEnDohbsk= github.com/kisielk/gotool v1.0.0/go.mod h1:XhKaO+MFFWcvkIS/tQcRk01m1F5IRFswLeQ+oQHNcck= @@ -144,6 +158,8 @@ github.com/labstack/echo/v4 v4.11.1 h1:dEpLU2FLg4UVmvCGPuk/APjlH6GDpbEPti61srUUU github.com/labstack/echo/v4 v4.11.1/go.mod h1:YuYRTSM3CHs2ybfrL8Px48bO6BAnYIN4l8wSTMP6BDQ= github.com/labstack/gommon v0.4.0 h1:y7cvthEAEbU0yHOf4axH8ZG2NH8knB9iNSoTO8dyIk8= github.com/labstack/gommon v0.4.0/go.mod h1:uW6kP17uPlLJsD3ijUYn3/M5bAxtlZhMI6m3MFxTMTM= +github.com/lib/pq v1.2.0 h1:LXpIM/LZ5xGFhOpXAQUIMM1HdyqzVYM13zNdjCEEcA0= +github.com/lib/pq v1.2.0/go.mod h1:5WUZQaWbwv1U+lTReE5YruASi9Al49XbQIvNi/34Woo= github.com/magiconair/properties v1.8.7 h1:IeQXZAiQcpL9mgcAe1Nu6cX9LLw6ExEHKjN0VQdvPDY= github.com/magiconair/properties v1.8.7/go.mod h1:Dhd985XPs7jluiymwWYZ0G4Z61jb3vdS329zhj2hYo0= github.com/mattn/go-colorable v0.1.11/go.mod h1:u5H1YNBxpqRaxsYJYSkiCWKzEfiAb1Gb520KVy5xxl4= @@ -153,10 +169,13 @@ github.com/mattn/go-isatty v0.0.14/go.mod h1:7GGIvUiUoEMVVmxf/4nioHXj79iQHKdU27k github.com/mattn/go-isatty v0.0.16/go.mod h1:kYGgaQfpe5nmfYZH+SKPsOc2e4SrIfOl2e/yFXSvRLM= github.com/mattn/go-isatty v0.0.19 h1:JITubQf0MOLdlGRuRq+jtsDlekdYPia9ZFsB8h/APPA= github.com/mattn/go-isatty v0.0.19/go.mod h1:W+V8PltTTMOvKvAeJH7IuucS94S2C6jfK/D7dTCTo3Y= +github.com/mattn/go-sqlite3 v1.14.6 h1:dNPt6NO46WmLVt2DLNpwczCmdV5boIZ6g/tlDrlRUbg= +github.com/mattn/go-sqlite3 v1.14.6/go.mod h1:NyWgC/yNuGj7Q9rpYnZvas74GogHl5/Z4A/KQRfk6bU= github.com/mitchellh/mapstructure v1.5.0 h1:jeMsZIYE/09sWLaz43PL7Gy6RuMjD2eJVyuac5Z2hdY= github.com/mitchellh/mapstructure v1.5.0/go.mod h1:bFUtVrKA4DC2yAKiSyO/QUcy7e+RRV2QTWOzhPopBRo= github.com/pelletier/go-toml/v2 v2.0.8 h1:0ctb6s9mE31h0/lhu+J6OPmVeDxJn+kYnJc2jZR9tGQ= github.com/pelletier/go-toml/v2 v2.0.8/go.mod h1:vuYfssBdrU2XDZ9bYydBu6t+6a6PYNcZljzZR9VXg+4= +github.com/pkg/errors v0.9.1 h1:FEBLx1zS214owpjy7qsBeixbURkuhQAwrK5UwLGTwt4= github.com/pkg/errors v0.9.1/go.mod h1:bwawxfHBFNV+L2hUp1rHADufV3IMtnDRdf1r5NINEl0= github.com/pkg/sftp v1.13.1/go.mod h1:3HaPG6Dq1ILlpPZRO0HVMrsydcdLt6HRDccSgb87qRg= github.com/pmezard/go-difflib v1.0.0 h1:4DBwDE0NGyQoBHbLQYPwSUPoCMWR5BEzIk/f1lZbAQM= @@ -166,6 +185,8 @@ github.com/rogpeppe/go-internal v1.3.0/go.mod h1:M8bDsm7K2OlrFYOpmOWEs/qY81heoFR github.com/rogpeppe/go-internal v1.9.0 h1:73kH8U+JUqXU8lRuOHeVHaa/SZPifC7BkcraZVejAe8= github.com/rogpeppe/go-internal v1.9.0/go.mod h1:WtVeX8xhTBvf0smdhujwtBcq4Qrzq/fJaraNFVN+nFs= github.com/russross/blackfriday/v2 v2.1.0/go.mod h1:+Rmxgy9KzJVeS9/2gXHxylqXiyQDYRxCVz55jmeOWTM= +github.com/shopspring/decimal v1.3.1 h1:2Usl1nmF/WZucqkFZhnfFYxxxu8LG21F6nPQBE5gKV8= +github.com/shopspring/decimal v1.3.1/go.mod h1:DKyhrW/HYNuLGql+MJL6WCR6knT2jwCFRcu2hWCYk4o= github.com/spf13/afero v1.9.5 h1:stMpOSZFs//0Lv29HduCmli3GUfpFoF3Y1Q/aXj/wVM= github.com/spf13/afero v1.9.5/go.mod h1:UBogFpq8E9Hx+xc5CNTTEpTnuHVmXDwZcZcE1eb/UhQ= github.com/spf13/cast v1.5.1 h1:R+kOtfhWQE6TVQzY+4D7wJLBgkdVasCEFxSUBYBYIlA= From 92e7a45b9f2b47f79cb037c875a66a14afd11d67 Mon Sep 17 00:00:00 2001 From: Victor Lacasse-Beaudoin Date: Sat, 16 Sep 2023 15:07:36 -0400 Subject: [PATCH 12/55] Ajouter squelette de apihandler.ScanPOST --- apihandler/apihandler.go | 9 +++++++++ apiresponse/apiresponse.go | 8 ++++++++ 2 files changed, 17 insertions(+) diff --git a/apihandler/apihandler.go b/apihandler/apihandler.go index a485de9..ae97e0f 100644 --- a/apihandler/apihandler.go +++ b/apihandler/apihandler.go @@ -94,3 +94,12 @@ func (a *APIHandler) ScanGET(c echo.Context) error { return c.JSON(r.StatusCode, r) } + +// ScanPOST is the handler for `POST /v{version}/scan/{membre_id}/ http/1.1` +func (a *APIHandler) ScanPOST(c echo.Context) error { + var r apiresponse.ScanPOST + + _ = r + + return nil +} diff --git a/apiresponse/apiresponse.go b/apiresponse/apiresponse.go index 619f240..cdeb9c0 100644 --- a/apiresponse/apiresponse.go +++ b/apiresponse/apiresponse.go @@ -24,3 +24,11 @@ type ScanGET struct { IsScanned bool } } + +// ScanPOST is the response type for `POST /v:version/scan/ http/1.1` +type ScanPOST struct { + Response + Data struct { + MembreID string + } +} From 8d9b52f51c436601c2e4603b41907b4527d53f94 Mon Sep 17 00:00:00 2001 From: Victor Lacasse-Beaudoin Date: Sat, 16 Sep 2023 16:08:23 -0400 Subject: [PATCH 13/55] Ajouter dbschema et dbstruct MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Contiennent respective le schéma de base de donnée et l'objet dbstruct.Presence, pour en manipuler les données --- dbschema/dbschema.go | 11 +++++++++++ dbstruct/dbstruct.go | 14 ++++++++++++++ 2 files changed, 25 insertions(+) create mode 100644 dbschema/dbschema.go create mode 100644 dbstruct/dbstruct.go diff --git a/dbschema/dbschema.go b/dbschema/dbschema.go new file mode 100644 index 0000000..e18b72d --- /dev/null +++ b/dbschema/dbschema.go @@ -0,0 +1,11 @@ +// Package dbschema defines the database schema for the application +package dbschema + +const Schema string = ` +CREATE TABLE IF NOT EXISTS presences ( + id VARCHAR(7) PRIMARY KEY NOT NULL, + at TIMESTAMP NOT NULL, + name VARCHAR(50) NOT NULL, + programme_id NOT NULL +); +` diff --git a/dbstruct/dbstruct.go b/dbstruct/dbstruct.go new file mode 100644 index 0000000..8dd52e7 --- /dev/null +++ b/dbstruct/dbstruct.go @@ -0,0 +1,14 @@ +/* +Package dbstruct provides struct types used to represent data declared in +dbschema and marshalled / unmarshalled by dbclient +*/ +package dbstruct + +import "time" + +type Presence struct { + ID string `db:"id" json:"id" csv:"id"` + At *time.Time `db:"at" json:"at" csv:"at"` + Name string `db:"name" json:"name" csv:"name"` + ProgrammeID string `db:"programme_id" json:"programme_id" csv:"programme_id"` +} From 76a3b9b10550d333c0050b9410933146251218f6 Mon Sep 17 00:00:00 2001 From: Victor Lacasse-Beaudoin Date: Sat, 16 Sep 2023 16:28:18 -0400 Subject: [PATCH 14/55] Ajouter type dbclient.DBClient et func dbclient.New --- dbclient/dbclient.go | 38 ++++++++++++++++++++++++++++++++++++++ 1 file changed, 38 insertions(+) diff --git a/dbclient/dbclient.go b/dbclient/dbclient.go index 61c4d69..85049ea 100644 --- a/dbclient/dbclient.go +++ b/dbclient/dbclient.go @@ -1,2 +1,40 @@ // Package dbclient provides the database client used by the API server package dbclient + +import ( + "fmt" + + "github.com/jmoiron/sqlx" +) + +// DBClient holds a *sqlx.DB and implements methods to manipulate the database +type DBClient struct { + DB *sqlx.DB +} + +func New(host, database, user, password string, port int, useSSL bool) (*DBClient, error) { + var SSLMode string + + switch useSSL { + case true: + SSLMode = "enable" + case false: + SSLMode = "disable" + } + + connectionString := fmt.Sprintf("postgres://%s:%s@%s:%d/%s?sslmode=%s", + user, + password, + host, + port, + database, + SSLMode, + ) + + db, err := sqlx.Connect("pgx", connectionString) + if err != nil { + return nil, err + } + + return &DBClient{DB: db}, nil +} From 2af75e1ecf9b8a8fa98f082b760ff31f50ac9904 Mon Sep 17 00:00:00 2001 From: Victor Lacasse-Beaudoin Date: Sat, 16 Sep 2023 17:08:56 -0400 Subject: [PATCH 15/55] =?UTF-8?q?Ajouter=20dbschema/=20et=20dbstruct/=20?= =?UTF-8?q?=C3=A0=20build=20step?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- Dockerfile | 2 ++ 1 file changed, 2 insertions(+) diff --git a/Dockerfile b/Dockerfile index 3e11ae5..499b2a3 100644 --- a/Dockerfile +++ b/Dockerfile @@ -13,6 +13,8 @@ ADD apiresponse/ apiresponse/ ADD cmd/ cmd/ ADD config/ config/ ADD dbclient/ dbclient/ +ADD dbschema/ dbschema/ +ADD dbstruct/ dbstruct/ ADD webcontent/ webcontent/ ADD webhandler/ webhandler/ From 20fa0e10d1fbfb29750ee525f781caf1b9155d8d Mon Sep 17 00:00:00 2001 From: Victor Lacasse-Beaudoin Date: Sat, 16 Sep 2023 17:10:52 -0400 Subject: [PATCH 16/55] Fix schema MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit PRIMARY KEY est toujours UNIQUE et NOT NULL, alors NOT NULL est redondant Assigner type VARCHAR(6) à presences.programme_id --- dbschema/dbschema.go | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/dbschema/dbschema.go b/dbschema/dbschema.go index e18b72d..b1c6030 100644 --- a/dbschema/dbschema.go +++ b/dbschema/dbschema.go @@ -3,9 +3,9 @@ package dbschema const Schema string = ` CREATE TABLE IF NOT EXISTS presences ( - id VARCHAR(7) PRIMARY KEY NOT NULL, + id VARCHAR(7) PRIMARY KEY, at TIMESTAMP NOT NULL, name VARCHAR(50) NOT NULL, - programme_id NOT NULL + programme_id VARCHAR(6) NOT NULL ); ` From c583220fd66de0adc031a81c01ff9df527d5868b Mon Sep 17 00:00:00 2001 From: Victor Lacasse-Beaudoin Date: Sat, 16 Sep 2023 17:13:51 -0400 Subject: [PATCH 17/55] Ajouter dbschema.DBClient#CreateTablesIfNotExist() --- dbclient/dbclient.go | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/dbclient/dbclient.go b/dbclient/dbclient.go index 85049ea..5e763ea 100644 --- a/dbclient/dbclient.go +++ b/dbclient/dbclient.go @@ -4,6 +4,7 @@ package dbclient import ( "fmt" + "git.agecem.com/agecem/bottin-ag/dbschema" "github.com/jmoiron/sqlx" ) @@ -38,3 +39,8 @@ func New(host, database, user, password string, port int, useSSL bool) (*DBClien return &DBClient{DB: db}, nil } + +func (d *DBClient) CreateTablesIfNotExist() error { + _, err := d.DB.Exec(dbschema.Schema) + return err +} From 622efd8d637a8dd3301adb8b265c5223fbdc5e81 Mon Sep 17 00:00:00 2001 From: Victor Lacasse-Beaudoin Date: Sat, 16 Sep 2023 17:19:32 -0400 Subject: [PATCH 18/55] Retirer field Data.DBStatus de apiresponse.HealthGET --- apihandler/apihandler.go | 13 ------------- apiresponse/apiresponse.go | 1 - 2 files changed, 14 deletions(-) diff --git a/apihandler/apihandler.go b/apihandler/apihandler.go index ae97e0f..e051ce1 100644 --- a/apihandler/apihandler.go +++ b/apihandler/apihandler.go @@ -5,7 +5,6 @@ import ( "fmt" "net/http" - "git.agecem.com/agecem/bottin-ag/apierror" "git.agecem.com/agecem/bottin-ag/apiresponse" bottindata "git.agecem.com/agecem/bottin/v5/data" "github.com/labstack/echo/v4" @@ -42,18 +41,6 @@ func (a *APIHandler) HealthGET(c echo.Context) error { r.Data.BottinStatus = bottinStatus } - // TODO - r.Data.DBStatus = "not implemented" - - if r.Data.BottinStatus == "not implemented" || r.Data.DBStatus == "not implemented" { - var err apierror.ErrBottinOrDBNotImplemented - r.Error = err.Error() - r.StatusCode = http.StatusInternalServerError - r.Message = "not ok" - - return c.JSON(r.StatusCode, r) - } - return c.JSON(r.StatusCode, r) } diff --git a/apiresponse/apiresponse.go b/apiresponse/apiresponse.go index cdeb9c0..d034916 100644 --- a/apiresponse/apiresponse.go +++ b/apiresponse/apiresponse.go @@ -13,7 +13,6 @@ type HealthGET struct { Response Data struct { BottinStatus string - DBStatus string } } From a88809f91e83f3fd331bb4036a9f1d520109043c Mon Sep 17 00:00:00 2001 From: Victor Lacasse-Beaudoin Date: Sat, 16 Sep 2023 17:21:18 -0400 Subject: [PATCH 19/55] =?UTF-8?q?Retirer=20validation=20probl=C3=A9matique?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Si le handler était nil, la vérification serait probablement assez pour faire panic l'application, ce qui serait un problème que la validation soit présente ou non. --- cmd/api.go | 3 --- 1 file changed, 3 deletions(-) diff --git a/cmd/api.go b/cmd/api.go index 26f18ce..71e1304 100644 --- a/cmd/api.go +++ b/cmd/api.go @@ -32,9 +32,6 @@ var apiCmd = &cobra.Command{ v0 := e.Group("/v0") handler := apihandler.New() - if &handler == nil { - log.Fatal("Newly created APIHandler is nil") - } handler.BottinAPIClient = bottindata.NewApiClient("bottin", "localhost", "http", 1312) From 682d8fc6aae5e6667b1943b1b284b70ddfc0b4a5 Mon Sep 17 00:00:00 2001 From: Victor Lacasse-Beaudoin Date: Sat, 16 Sep 2023 17:22:12 -0400 Subject: [PATCH 20/55] =?UTF-8?q?Cr=C3=A9er=20tables=20sur=20d=C3=A9marrag?= =?UTF-8?q?e=20de=20apiCmd?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- apihandler/apihandler.go | 2 ++ cmd/api.go | 12 ++++++++++++ 2 files changed, 14 insertions(+) diff --git a/apihandler/apihandler.go b/apihandler/apihandler.go index e051ce1..8c4bd8e 100644 --- a/apihandler/apihandler.go +++ b/apihandler/apihandler.go @@ -6,6 +6,7 @@ import ( "net/http" "git.agecem.com/agecem/bottin-ag/apiresponse" + "git.agecem.com/agecem/bottin-ag/dbclient" bottindata "git.agecem.com/agecem/bottin/v5/data" "github.com/labstack/echo/v4" ) @@ -26,6 +27,7 @@ routes */ type APIHandler struct { BottinAPIClient *bottindata.ApiClient + DBClient *dbclient.DBClient } // HealthGET is the handler for `GET /v:version/health/ http/1.1` diff --git a/cmd/api.go b/cmd/api.go index 71e1304..c55e4b2 100644 --- a/cmd/api.go +++ b/cmd/api.go @@ -9,6 +9,7 @@ import ( "git.agecem.com/agecem/bottin-ag/apihandler" "git.agecem.com/agecem/bottin-ag/config" + "git.agecem.com/agecem/bottin-ag/dbclient" bottindata "git.agecem.com/agecem/bottin/v5/data" "github.com/labstack/echo/v4" "github.com/labstack/echo/v4/middleware" @@ -35,6 +36,17 @@ var apiCmd = &cobra.Command{ handler.BottinAPIClient = bottindata.NewApiClient("bottin", "localhost", "http", 1312) + dbClient, err := dbclient.New("db", "bottinag", "bottinag", "bottinag", 5432, false) + if err != nil { + log.Fatal(err) + } + + handler.DBClient = dbClient + + if err := handler.DBClient.CreateTablesIfNotExist(); err != nil { + log.Fatal(err) + } + apihandler.DeclareRoutes(v0, &handler) e.Start(fmt.Sprintf(":%d", cfg.API.Port)) From 61237996509487ac7f20eb77b3bac43ef4d6bbb3 Mon Sep 17 00:00:00 2001 From: Victor Lacasse-Beaudoin Date: Sat, 16 Sep 2023 17:44:38 -0400 Subject: [PATCH 21/55] =?UTF-8?q?Ajouter=20pointers=20=C3=A0=20clients=20e?= =?UTF-8?q?n=20param=C3=A8tres=20=C3=A0=20apihandler.New?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- apihandler/apihandler.go | 11 +++++++++-- cmd/api.go | 6 ++---- 2 files changed, 11 insertions(+), 6 deletions(-) diff --git a/apihandler/apihandler.go b/apihandler/apihandler.go index 8c4bd8e..1339e8e 100644 --- a/apihandler/apihandler.go +++ b/apihandler/apihandler.go @@ -17,8 +17,15 @@ func DeclareRoutes(e *echo.Group, h *APIHandler) { e.GET("/scan/:membre_id/", h.ScanGET) } -func New() (handler APIHandler) { - return +/* +New retourne un nouveau APIHandler contenant des pointers vers les clients +nécessaires à l'exécution du API server +*/ +func New(bottinAPIClient *bottindata.ApiClient, dbClient *dbclient.DBClient) APIHandler { + return APIHandler{ + BottinAPIClient: bottinAPIClient, + DBClient: dbClient, + } } /* diff --git a/cmd/api.go b/cmd/api.go index c55e4b2..d0e5c5b 100644 --- a/cmd/api.go +++ b/cmd/api.go @@ -32,16 +32,14 @@ var apiCmd = &cobra.Command{ v0 := e.Group("/v0") - handler := apihandler.New() - - handler.BottinAPIClient = bottindata.NewApiClient("bottin", "localhost", "http", 1312) + bottinApiClient := bottindata.NewApiClient("bottin", "localhost", "http", 1312) dbClient, err := dbclient.New("db", "bottinag", "bottinag", "bottinag", 5432, false) if err != nil { log.Fatal(err) } - handler.DBClient = dbClient + handler := apihandler.New(bottinApiClient, dbClient) if err := handler.DBClient.CreateTablesIfNotExist(); err != nil { log.Fatal(err) From 5b109ae9736231c94a34f2af6b6271163f56aa0d Mon Sep 17 00:00:00 2001 From: Victor Lacasse-Beaudoin Date: Sat, 16 Sep 2023 18:10:14 -0400 Subject: [PATCH 22/55] Ajouter config.RegisterInt et config.RegisterString --- config/config.go | 22 ++++++++++++++++++++++ 1 file changed, 22 insertions(+) diff --git a/config/config.go b/config/config.go index 3e80868..61b0c6a 100644 --- a/config/config.go +++ b/config/config.go @@ -26,6 +26,28 @@ func UnmarshalConfig() (cfg Config, err error) { return cfg, viper.Unmarshal(&cfg) } +// RegisterInt registers a new cobra int flag and associated viper config option +func RegisterInt(cmd *cobra.Command, isPersistent bool, viperName, cobraName, cobraDescription string, cobraDefault int) error { + if isPersistent { + cmd.PersistentFlags().Int(cobraName, cobraDefault, cobraDescription) + return viper.BindPFlag(viperName, cmd.PersistentFlags().Lookup(cobraName)) + } else { + cmd.Flags().Int(cobraName, cobraDefault, cobraDescription) + return viper.BindPFlag(viperName, cmd.Flags().Lookup(cobraName)) + } +} + +// RegisterString registers a new cobra string flag and associated viper config option +func RegisterString(cmd *cobra.Command, isPersistent bool, viperName, cobraName, cobraDescription string, cobraDefault string) error { + if isPersistent { + cmd.PersistentFlags().String(cobraName, cobraDefault, cobraDescription) + return viper.BindPFlag(viperName, cmd.PersistentFlags().Lookup(cobraName)) + } else { + cmd.Flags().String(cobraName, cobraDefault, cobraDescription) + return viper.BindPFlag(viperName, cmd.Flags().Lookup(cobraName)) + } +} + // RegisterFlags adds persistent flags necessary to the application to the specified *cobra.Command func RegisterFlags(cmd *cobra.Command) error { // api.port ; --api-port From d2df4cd4691d5594c1ba92dd7ef55fc308927d77 Mon Sep 17 00:00:00 2001 From: Victor Lacasse-Beaudoin Date: Sat, 16 Sep 2023 18:12:02 -0400 Subject: [PATCH 23/55] Register bottin.api.host --- config/config.go | 17 +++++++++++++++-- 1 file changed, 15 insertions(+), 2 deletions(-) diff --git a/config/config.go b/config/config.go index 61b0c6a..21ba7c0 100644 --- a/config/config.go +++ b/config/config.go @@ -10,14 +10,21 @@ import ( ) type Config struct { - API APIConfig - Web WebConfig + API APIConfig + Bottin BottinConfig + Web WebConfig } type APIConfig struct { Port int } +type BottinConfig struct { + API struct { + Host string + } +} + type WebConfig struct { Port int } @@ -56,6 +63,12 @@ func RegisterFlags(cmd *cobra.Command) error { return err } + // bottin.api.host + if err := RegisterString(cmd, true, + "bottin.api.host", "bottin-api-host", "Bottin API server host", "localhost"); 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 f6476316e93ea32ad29c555d8f7fc282aee647cc Mon Sep 17 00:00:00 2001 From: Victor Lacasse-Beaudoin Date: Sat, 16 Sep 2023 18:13:13 -0400 Subject: [PATCH 24/55] Ignorer cmd/test.go --- .gitignore | 2 ++ 1 file changed, 2 insertions(+) diff --git a/.gitignore b/.gitignore index e52cdbd..301c534 100644 --- a/.gitignore +++ b/.gitignore @@ -4,3 +4,5 @@ *.swp *.swo *.test + +cmd/test.go From ea49f1609ffbce4fd4d37e57c5a1cb1402cdeb3c Mon Sep 17 00:00:00 2001 From: Victor Lacasse-Beaudoin Date: Sat, 16 Sep 2023 18:16:32 -0400 Subject: [PATCH 25/55] =?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 26/55] =?UTF-8?q?Ajouter=20et=20impl=C3=A9menter=20cfg.Bot?= =?UTF-8?q?tin.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 27/55] =?UTF-8?q?Ajouter=20et=20impl=C3=A9menter=20cfg.Bot?= =?UTF-8?q?tin.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 { From 7e3531aa90909333d110e82fb53fe8ad13a4db8b Mon Sep 17 00:00:00 2001 From: Victor Lacasse-Beaudoin Date: Sat, 16 Sep 2023 18:40:18 -0400 Subject: [PATCH 28/55] =?UTF-8?q?Ajouter=20et=20impl=C3=A9menter=20db=20fl?= =?UTF-8?q?ags?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Ajouter config.RegisterBool --- cmd/api.go | 2 +- config/config.go | 57 ++++++++++++++++++++++++++++++++++++++++++++++++ 2 files changed, 58 insertions(+), 1 deletion(-) diff --git a/cmd/api.go b/cmd/api.go index 841b80f..a612846 100644 --- a/cmd/api.go +++ b/cmd/api.go @@ -34,7 +34,7 @@ var apiCmd = &cobra.Command{ 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) + dbClient, err := dbclient.New(cfg.DB.Host, cfg.DB.Database, cfg.DB.User, cfg.DB.Password, cfg.DB.Port, cfg.DB.UseSSL) if err != nil { log.Fatal(err) } diff --git a/config/config.go b/config/config.go index 6131b25..2cae9e4 100644 --- a/config/config.go +++ b/config/config.go @@ -12,6 +12,7 @@ import ( type Config struct { API APIConfig Bottin BottinConfig + DB DBConfig Web WebConfig } @@ -28,6 +29,15 @@ type BottinConfig struct { } } +type DBConfig struct { + Database string + Host string + Password string + Port int + User string + UseSSL bool `mapstructure:"use_ssl"` +} + type WebConfig struct { Port int } @@ -36,6 +46,17 @@ func UnmarshalConfig() (cfg Config, err error) { return cfg, viper.Unmarshal(&cfg) } +// RegisterBool registers a new cobra bool flag and associated viper config option +func RegisterBool(cmd *cobra.Command, isPersistent bool, viperName, cobraName, cobraDescription string, cobraDefault bool) error { + if isPersistent { + cmd.PersistentFlags().Bool(cobraName, cobraDefault, cobraDescription) + return viper.BindPFlag(viperName, cmd.PersistentFlags().Lookup(cobraName)) + } else { + cmd.Flags().Bool(cobraName, cobraDefault, cobraDescription) + return viper.BindPFlag(viperName, cmd.Flags().Lookup(cobraName)) + } +} + // RegisterInt registers a new cobra int flag and associated viper config option func RegisterInt(cmd *cobra.Command, isPersistent bool, viperName, cobraName, cobraDescription string, cobraDefault int) error { if isPersistent { @@ -90,6 +111,42 @@ func RegisterFlags(cmd *cobra.Command) error { return err } + // db.database + if err := RegisterString(cmd, true, + "db.database", "db-database", "PostgreSQL database", "bottinag"); err != nil { + return err + } + + // db.host + if err := RegisterString(cmd, true, + "db.host", "db-host", "PostgreSQL host", "db"); err != nil { + return err + } + + // db.password + if err := RegisterString(cmd, true, + "db.password", "db-password", "PostgreSQL password", "bottinag"); err != nil { + return err + } + + // db.port + if err := RegisterInt(cmd, true, + "db.port", "db-port", "PostgreSQL port", 5432); err != nil { + return err + } + + // db.user + if err := RegisterString(cmd, true, + "db.user", "db-user", "PostgreSQL user", "bottinag"); err != nil { + return err + } + + // db.use_ssl + if err := RegisterBool(cmd, true, + "db.use_ssl", "db-use-ssl", "PostgreSQL use_ssl", false); 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 f3f15dd3117ee717dd04805dc1d60d8a5362985b Mon Sep 17 00:00:00 2001 From: Victor Lacasse-Beaudoin Date: Sat, 16 Sep 2023 19:16:43 -0400 Subject: [PATCH 29/55] Fix HealthGET statuscode et message parfois vide --- apihandler/apihandler.go | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-) diff --git a/apihandler/apihandler.go b/apihandler/apihandler.go index 1339e8e..a7a21bf 100644 --- a/apihandler/apihandler.go +++ b/apihandler/apihandler.go @@ -41,15 +41,24 @@ type APIHandler struct { func (a *APIHandler) HealthGET(c echo.Context) error { var r apiresponse.HealthGET + r.Message = "not ok" + bottinStatus, err := a.BottinAPIClient.GetHealth() if err != nil { - r.Message = "not ok" r.StatusCode = http.StatusInternalServerError r.Data.BottinStatus = err.Error() } else { r.Data.BottinStatus = bottinStatus } + switch r.Data.BottinStatus { + case "Bottin API v5 is ready": + r.Message = "ok" + r.StatusCode = http.StatusOK + default: + r.StatusCode = http.StatusInternalServerError + } + return c.JSON(r.StatusCode, r) } From bae70e1569641129baa8ef743bd4c5d21f51f35b Mon Sep 17 00:00:00 2001 From: Victor Lacasse-Beaudoin Date: Sat, 16 Sep 2023 23:06:24 -0400 Subject: [PATCH 30/55] Ajouter dbclient.DBClient.InsertPresence --- dbclient/dbclient.go | 28 ++++++++++++++++++++++++++++ 1 file changed, 28 insertions(+) diff --git a/dbclient/dbclient.go b/dbclient/dbclient.go index 5e763ea..d6731e3 100644 --- a/dbclient/dbclient.go +++ b/dbclient/dbclient.go @@ -5,6 +5,7 @@ import ( "fmt" "git.agecem.com/agecem/bottin-ag/dbschema" + "git.agecem.com/agecem/bottin-ag/dbstruct" "github.com/jmoiron/sqlx" ) @@ -44,3 +45,30 @@ func (d *DBClient) CreateTablesIfNotExist() error { _, err := d.DB.Exec(dbschema.Schema) return err } + +/* +InsertPresence inserts a dbstruct.Presence into the database, returning the +values of the inserted presence and any error that occured. +*/ +func (d *DBClient) InsertPresence(presence dbstruct.Presence) (dbstruct.Presence, error) { + var insertedPresence dbstruct.Presence + var rows *sqlx.Rows + + rows, err := d.DB.NamedQuery(` + INSERT INTO presences (id, at, name, programme_id) + VALUES (:id, current_timestamp, :name, :programme_id) + RETURNING id, at, name, programme_id + `, presence) + if err != nil { + return insertedPresence, err + } + defer rows.Close() + + for rows.Next() { + if err := rows.Scan(&insertedPresence.ID, &insertedPresence.At, &insertedPresence.Name, &insertedPresence.ProgrammeID); err != nil { + return insertedPresence, err + } + } + + return insertedPresence, nil +} From cfba108df9ed620a87831e0cd7c8984480071a2f Mon Sep 17 00:00:00 2001 From: Victor Lacasse-Beaudoin Date: Sat, 16 Sep 2023 23:07:07 -0400 Subject: [PATCH 31/55] Retirer apiresponse.ScanGET.Data MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit MembreID n'était pas nécessaire de garder dans le struct, sera ramené si jamais le data est nécessaire --- apiresponse/apiresponse.go | 3 --- 1 file changed, 3 deletions(-) diff --git a/apiresponse/apiresponse.go b/apiresponse/apiresponse.go index d034916..0508b64 100644 --- a/apiresponse/apiresponse.go +++ b/apiresponse/apiresponse.go @@ -27,7 +27,4 @@ type ScanGET struct { // ScanPOST is the response type for `POST /v:version/scan/ http/1.1` type ScanPOST struct { Response - Data struct { - MembreID string - } } From efcecbce6eb5fb7420ba89e2f39fe11afdf3d67a Mon Sep 17 00:00:00 2001 From: Victor Lacasse-Beaudoin Date: Sat, 16 Sep 2023 23:07:52 -0400 Subject: [PATCH 32/55] =?UTF-8?q?Impl=C3=A9menter=20apihandler.APIHandler.?= =?UTF-8?q?ScanPOST?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- apihandler/apihandler.go | 64 ++++++++++++++++++++++++++++++++++++++-- 1 file changed, 62 insertions(+), 2 deletions(-) diff --git a/apihandler/apihandler.go b/apihandler/apihandler.go index a7a21bf..a584e8a 100644 --- a/apihandler/apihandler.go +++ b/apihandler/apihandler.go @@ -7,6 +7,7 @@ import ( "git.agecem.com/agecem/bottin-ag/apiresponse" "git.agecem.com/agecem/bottin-ag/dbclient" + "git.agecem.com/agecem/bottin-ag/dbstruct" bottindata "git.agecem.com/agecem/bottin/v5/data" "github.com/labstack/echo/v4" ) @@ -15,6 +16,7 @@ import ( func DeclareRoutes(e *echo.Group, h *APIHandler) { e.GET("/health/", h.HealthGET) e.GET("/scan/:membre_id/", h.ScanGET) + e.POST("/scan/:membre_id/", h.ScanPOST) } /* @@ -97,6 +99,8 @@ func (a *APIHandler) ScanGET(c echo.Context) error { r.Message = fmt.Sprintf("%s est membre de l'AGECEM", membreID) } + //TODO remplir r.Data.IsScanned + return c.JSON(r.StatusCode, r) } @@ -104,7 +108,63 @@ func (a *APIHandler) ScanGET(c echo.Context) error { func (a *APIHandler) ScanPOST(c echo.Context) error { var r apiresponse.ScanPOST - _ = r + membreID := c.Param("membre_id") - return nil + membre, err := a.BottinAPIClient.GetMembre(membreID) + if err != nil { + switch err.Error() { + case "Ce numéro étudiant ne correspond à aucunE membre": + r.Message = fmt.Sprintf("%s n'est pas membre de l'AGECEM", membreID) + r.Error = err.Error() + r.StatusCode = http.StatusNotFound + + return c.JSON(r.StatusCode, r) + case "Veuillez fournir un numéro étudiant à rechercher": + r.Error = "membre_id ne peut pas être vide" + r.StatusCode = http.StatusBadRequest + r.Message = err.Error() + + return c.JSON(r.StatusCode, r) + default: + r.Error = err.Error() + r.Message = "Erreur lors de BottinAPIClient.GetMembre" + r.StatusCode = http.StatusInternalServerError + + return c.JSON(r.StatusCode, r) + } + } + + var presence dbstruct.Presence + + presence.ID = membre.ID + presence.ProgrammeID = membre.ProgrammeID + + switch membre.PreferedName != "" { + case true: + presence.Name = membre.PreferedName + case false: + presence.Name = fmt.Sprintf("%s, %s", membre.LastName, membre.FirstName) + } + + insertedPresence, err := a.DBClient.InsertPresence(presence) + if err != nil { + r.Error = err.Error() + r.Message = "Erreur lors de DBClient.InsertPresence" + r.StatusCode = http.StatusInternalServerError + + return c.JSON(r.StatusCode, r) + } + + if insertedPresence.ID == "" { + r.Error = "Membre déjà enregistré·e" + r.Message = fmt.Sprintf("Membre '%s' (%s) déjà enregistré·e.", presence.Name, presence.ID) + r.StatusCode = http.StatusBadRequest + + return c.JSON(r.StatusCode, r) + } + + r.StatusCode = http.StatusOK + r.Message = fmt.Sprintf("Membre '%s' (%s) enregistré·e avec succès, veuillez lui donner son carton de vote. Bonne assemblée!", insertedPresence.Name, insertedPresence.ID) + + return c.JSON(r.StatusCode, r) } From 30b47d279280eb24b231ba5a55a9beef42e39314 Mon Sep 17 00:00:00 2001 From: Victor Lacasse-Beaudoin Date: Sat, 16 Sep 2023 23:21:27 -0400 Subject: [PATCH 33/55] Ajouter interface Responder --- apiresponse/apiresponse.go | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/apiresponse/apiresponse.go b/apiresponse/apiresponse.go index 0508b64..2114a9b 100644 --- a/apiresponse/apiresponse.go +++ b/apiresponse/apiresponse.go @@ -8,6 +8,14 @@ type Response struct { StatusCode int } +type Responder interface { + Respond() Responder +} + +func (r Response) Respond() Responder { + return r +} + // HealthGET is the response type for `GET /v:version/health/ http/1.1` type HealthGET struct { Response From f77fcd551fa8ae5b46af753c548b521f07aa620d Mon Sep 17 00:00:00 2001 From: Victor Lacasse-Beaudoin Date: Sat, 16 Sep 2023 23:21:46 -0400 Subject: [PATCH 34/55] =?UTF-8?q?Ajouter=20apiclient.APIClient=20et=20m?= =?UTF-8?q?=C3=A9thodes=20de=20base?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Ajouter apiclient.New Ajouter apiclient.APIClient.Call Ajouter apiclient.APIClient.CallResponder --- apiclient/apiclient.go | 83 ++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 83 insertions(+) diff --git a/apiclient/apiclient.go b/apiclient/apiclient.go index 2a74a7e..3de0e62 100644 --- a/apiclient/apiclient.go +++ b/apiclient/apiclient.go @@ -1,2 +1,85 @@ // Package apiclient provides the API client used by the web app package apiclient + +import ( + "encoding/json" + "fmt" + "io" + "net/http" + + "git.agecem.com/agecem/bottin-ag/apiresponse" +) + +type APIClient struct { + Key string + Host string + Port int + Protocol string +} + +func New(key, host, protocol string, port int) APIClient { + return APIClient{ + Key: key, + Host: host, + Port: port, + Protocol: protocol, + } +} + +// Makes APIClient.Call() returning only an error. The Call data is put into the responder parameter's reference +func (a *APIClient) CallResponder(method, route string, requestBody io.Reader, useKey bool, responder apiresponse.Responder) error { + callResponse, err := a.Call(method, route, requestBody, useKey) + if err != nil { + return err + } + defer callResponse.Body.Close() + + body, err := io.ReadAll(callResponse.Body) + if err != nil { + return err + } + + err = json.Unmarshal(body, responder) + if err != nil { + return err + } + + return nil +} + +func (a *APIClient) Call(method, route string, requestBody io.Reader, useKey bool) (*http.Response, error) { + var response *http.Response + + endpoint := fmt.Sprintf("%s://%s:%d%s", + a.Protocol, a.Host, a.Port, route, + ) + + // Create client + client := &http.Client{} + + // Create request + request, err := http.NewRequest(method, endpoint, requestBody) + if err != nil { + return response, err + } + + if useKey { + if a.Key == "" { + return response, fmt.Errorf("Call to API required a key but none was provided. See --help for instructions on providing an API key.") + } + + request.Header.Add("Authorization", fmt.Sprintf("Bearer %s", a.Key)) + } + + if requestBody != nil { + request.Header.Add("Content-Type", "application/json") + } + + // Fetch Request + response, err = client.Do(request) + if err != nil { + return response, err + } + + return response, nil +} From f986c2e8e1ca5bbaefb610c7ab3390fbb4acab4b Mon Sep 17 00:00:00 2001 From: Victor Lacasse-Beaudoin Date: Sun, 17 Sep 2023 01:12:46 -0400 Subject: [PATCH 35/55] Add basic webcontent --- cmd/web.go | 8 ++++++++ webcontent/html/index.html | 4 ++++ webcontent/webcontent.go | 29 +++++++++++++++++++++++++++++ webhandler/webhandler.go | 27 +++++++++++++++++++++++++++ webresponse/webresponse.go | 7 +++++++ 5 files changed, 75 insertions(+) create mode 100644 webresponse/webresponse.go diff --git a/cmd/web.go b/cmd/web.go index 08c1286..37a678a 100644 --- a/cmd/web.go +++ b/cmd/web.go @@ -8,6 +8,8 @@ import ( "log" "git.agecem.com/agecem/bottin-ag/config" + "git.agecem.com/agecem/bottin-ag/webcontent" + "git.agecem.com/agecem/bottin-ag/webhandler" "github.com/labstack/echo/v4" "github.com/labstack/echo/v4/middleware" "github.com/spf13/cobra" @@ -25,8 +27,14 @@ var webCmd = &cobra.Command{ e := echo.New() + e.Renderer = webcontent.TemplateHTMLFS() + e.Pre(middleware.AddTrailingSlash()) + handler := webhandler.New() + + webhandler.DeclareRoutes(e, &handler) + e.Start(fmt.Sprintf(":%d", cfg.Web.Port)) }, } diff --git a/webcontent/html/index.html b/webcontent/html/index.html index 6cecd06..2a2f9de 100644 --- a/webcontent/html/index.html +++ b/webcontent/html/index.html @@ -1 +1,5 @@

agecem/bottin-ag

+ +

StatusCode: {{ .StatusCode }}

+

Message: {{ .Message }}

+

Error: {{ .Error }}

diff --git a/webcontent/webcontent.go b/webcontent/webcontent.go index 462e56d..135e4fe 100644 --- a/webcontent/webcontent.go +++ b/webcontent/webcontent.go @@ -3,3 +3,32 @@ Package webcontent provides the content to be embedded in the binary executable for the web app */ package webcontent + +import ( + "embed" + "io" + "text/template" + + "github.com/labstack/echo/v4" +) + +//go:embed html/*html +var htmlFS embed.FS + +func HTMLFS() embed.FS { + return htmlFS +} + +type Template struct { + templates *template.Template +} + +func (t *Template) Render(w io.Writer, name string, data interface{}, c echo.Context) error { + return t.templates.ExecuteTemplate(w, name, data) +} + +func TemplateHTMLFS() *Template { + return &Template{ + templates: template.Must(template.ParseFS(HTMLFS(), "html/*.html")), + } +} diff --git a/webhandler/webhandler.go b/webhandler/webhandler.go index 56f4475..006f5fe 100644 --- a/webhandler/webhandler.go +++ b/webhandler/webhandler.go @@ -1,2 +1,29 @@ // Package webhandler provides handlers for the web app routes package webhandler + +import ( + "net/http" + + "git.agecem.com/agecem/bottin-ag/webresponse" + "github.com/labstack/echo/v4" +) + +func DeclareRoutes(e *echo.Echo, h *WebHandler) { + e.GET("/", h.IndexGET) +} + +type WebHandler struct { +} + +func New() WebHandler { + return WebHandler{} +} + +func (w *WebHandler) IndexGET(c echo.Context) error { + var r webresponse.IndexGET + + r.Message = "foo" + r.StatusCode = http.StatusOK + + return c.Render(r.StatusCode, "index-html", r) +} diff --git a/webresponse/webresponse.go b/webresponse/webresponse.go new file mode 100644 index 0000000..88289ba --- /dev/null +++ b/webresponse/webresponse.go @@ -0,0 +1,7 @@ +package webresponse + +import "git.agecem.com/agecem/bottin-ag/apiresponse" + +type IndexGET struct { + apiresponse.Response +} From 55a033e8bd2422ddb2a7f5780f71d657f9935d3a Mon Sep 17 00:00:00 2001 From: Victor Lacasse-Beaudoin Date: Sun, 17 Sep 2023 01:25:06 -0400 Subject: [PATCH 36/55] =?UTF-8?q?Ajouter=20webresponse/=20=C3=A0=20Dockerf?= =?UTF-8?q?ile?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- Dockerfile | 1 + 1 file changed, 1 insertion(+) diff --git a/Dockerfile b/Dockerfile index 499b2a3..ff46c5c 100644 --- a/Dockerfile +++ b/Dockerfile @@ -17,6 +17,7 @@ ADD dbschema/ dbschema/ ADD dbstruct/ dbstruct/ ADD webcontent/ webcontent/ ADD webhandler/ webhandler/ +ADD webresponse/ webresponse/ RUN CGO_ENABLED=0 go build -a -installsuffix cgo -o bottin-ag . From 46f85acf81f8e8aac3800ce2af2670b4c2963626 Mon Sep 17 00:00:00 2001 From: Victor Lacasse-Beaudoin Date: Sun, 17 Sep 2023 01:25:45 -0400 Subject: [PATCH 37/55] =?UTF-8?q?Ajouter=20bloc=20{{=20define=20"index-htm?= =?UTF-8?q?l"=20}}=C2=A0manquant?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- webcontent/html/index.html | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) diff --git a/webcontent/html/index.html b/webcontent/html/index.html index 2a2f9de..47524f6 100644 --- a/webcontent/html/index.html +++ b/webcontent/html/index.html @@ -1,5 +1,7 @@ -

agecem/bottin-ag

+{{ define "index-html" }} +

agecem/bottin-ag

-

StatusCode: {{ .StatusCode }}

-

Message: {{ .Message }}

-

Error: {{ .Error }}

+

StatusCode: {{ .StatusCode }}

+

Message: {{ .Message }}

+

Error: {{ .Error }}

+{{ end }} From c218860e332407eb0369b8403ec5328fe6634049 Mon Sep 17 00:00:00 2001 From: Victor Lacasse-Beaudoin Date: Sun, 17 Sep 2023 16:32:40 -0400 Subject: [PATCH 38/55] =?UTF-8?q?Impl=C3=A9menter=20page=20web=20de=20scan?= =?UTF-8?q?=20de=20pr=C3=A9sence?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Voir diff pour détails --- apiclient/apiclient.go | 12 +++++- cmd/web.go | 12 +++++- config/config.go | 37 +++++++++++++++++++ webcontent/html/index.html | 26 +++++++++++-- webcontent/html/scan.html | 3 ++ webcontent/js/htmx.min.js | 1 + .../js/membreid-selected-and-cleared.js | 14 +++++++ webcontent/webcontent.go | 9 ++++- webhandler/webhandler.go | 31 +++++++++++++++- webresponse/webresponse.go | 4 ++ 10 files changed, 139 insertions(+), 10 deletions(-) create mode 100644 webcontent/html/scan.html create mode 100644 webcontent/js/htmx.min.js create mode 100644 webcontent/js/membreid-selected-and-cleared.js diff --git a/apiclient/apiclient.go b/apiclient/apiclient.go index 3de0e62..d68b7ad 100644 --- a/apiclient/apiclient.go +++ b/apiclient/apiclient.go @@ -17,8 +17,8 @@ type APIClient struct { Protocol string } -func New(key, host, protocol string, port int) APIClient { - return APIClient{ +func New(key, host, protocol string, port int) *APIClient { + return &APIClient{ Key: key, Host: host, Port: port, @@ -83,3 +83,11 @@ func (a *APIClient) Call(method, route string, requestBody io.Reader, useKey boo return response, nil } + +func (a *APIClient) Scan(membreID string) (response apiresponse.ScanPOST, err error) { + //TODO implement api key + //err = a.CallResponder(http.MethodPost, "/v0/scan", &buf, true, &response) + err = a.CallResponder(http.MethodPost, fmt.Sprintf("/v0/scan/%s", membreID), nil, false, &response) + + return +} diff --git a/cmd/web.go b/cmd/web.go index 37a678a..7f580f0 100644 --- a/cmd/web.go +++ b/cmd/web.go @@ -6,7 +6,9 @@ package cmd import ( "fmt" "log" + "net/http" + "git.agecem.com/agecem/bottin-ag/apiclient" "git.agecem.com/agecem/bottin-ag/config" "git.agecem.com/agecem/bottin-ag/webcontent" "git.agecem.com/agecem/bottin-ag/webhandler" @@ -31,10 +33,18 @@ var webCmd = &cobra.Command{ e.Pre(middleware.AddTrailingSlash()) - handler := webhandler.New() + apiClient := apiclient.New(cfg.Web.API.Key, cfg.Web.API.Host, cfg.Web.API.Protocol, cfg.Web.API.Port) + + handler := webhandler.New(apiClient) webhandler.DeclareRoutes(e, &handler) + publicGroup := e.Group("/public/*") + publicGroup.Use(middleware.StaticWithConfig(middleware.StaticConfig{ + Root: "/", + Filesystem: http.FS(webcontent.PublicFS()), + })) + e.Start(fmt.Sprintf(":%d", cfg.Web.Port)) }, } diff --git a/config/config.go b/config/config.go index 2cae9e4..c1f239a 100644 --- a/config/config.go +++ b/config/config.go @@ -17,6 +17,7 @@ type Config struct { } type APIConfig struct { + Key string Port int } @@ -39,6 +40,12 @@ type DBConfig struct { } type WebConfig struct { + API struct { + Host string + Key string + Port int + Protocol string + } Port int } @@ -87,6 +94,12 @@ func RegisterFlags(cmd *cobra.Command) error { return err } + // api.key ; --api-key + if err := RegisterString(cmd, true, + "api.key", "api-key", "API server key", "bottinag"); err != nil { + return err + } + // bottin.api.host if err := RegisterString(cmd, true, "bottin.api.host", "bottin-api-host", "Bottin API server host", "localhost"); err != nil { @@ -147,6 +160,30 @@ func RegisterFlags(cmd *cobra.Command) error { return err } + // web.api.host + if err := RegisterString(cmd, true, + "web.api.host", "web-api-host", "Webserver API client host", "localhost"); err != nil { + return err + } + + // web.api.key + if err := RegisterString(cmd, true, + "web.api.key", "web-api-key", "Webserver API client key", "bottinag"); err != nil { + return err + } + + // web.api.port + if err := RegisterInt(cmd, true, + "web.api.port", "web-api-port", "Webserver API client port", 3182); err != nil { + return err + } + + // web.api.protocol + if err := RegisterString(cmd, true, + "web.api.protocol", "web-api-protocol", "Webserver API client 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 { diff --git a/webcontent/html/index.html b/webcontent/html/index.html index 47524f6..c5f0e50 100644 --- a/webcontent/html/index.html +++ b/webcontent/html/index.html @@ -1,7 +1,25 @@ {{ define "index-html" }} -

agecem/bottin-ag

+ + + + + AGECEM | Assemblée Générale + + + + +

Présences en Assemblée Générale

-

StatusCode: {{ .StatusCode }}

-

Message: {{ .Message }}

-

Error: {{ .Error }}

+ {{ if .Error }}

Error: {{ .Error }}

{{ end }} + +
+ + + +
+ +
+
+ + {{ end }} diff --git a/webcontent/html/scan.html b/webcontent/html/scan.html new file mode 100644 index 0000000..d0b8c91 --- /dev/null +++ b/webcontent/html/scan.html @@ -0,0 +1,3 @@ +{{ define "scan-html" }} +

{{ .Message }}

+{{ end }} diff --git a/webcontent/js/htmx.min.js b/webcontent/js/htmx.min.js new file mode 100644 index 0000000..dee8eaf --- /dev/null +++ b/webcontent/js/htmx.min.js @@ -0,0 +1 @@ +(function(e,t){if(typeof define==="function"&&define.amd){define([],t)}else if(typeof module==="object"&&module.exports){module.exports=t()}else{e.htmx=e.htmx||t()}})(typeof self!=="undefined"?self:this,function(){return function(){"use strict";var G={onLoad:t,process:Nt,on:le,off:ue,trigger:oe,ajax:xr,find:b,findAll:f,closest:d,values:function(e,t){var r=er(e,t||"post");return r.values},remove:U,addClass:B,removeClass:n,toggleClass:V,takeClass:j,defineExtension:Rr,removeExtension:Or,logAll:X,logNone:F,logger:null,config:{historyEnabled:true,historyCacheSize:10,refreshOnHistoryMiss:false,defaultSwapStyle:"innerHTML",defaultSwapDelay:0,defaultSettleDelay:20,includeIndicatorStyles:true,indicatorClass:"htmx-indicator",requestClass:"htmx-request",addedClass:"htmx-added",settlingClass:"htmx-settling",swappingClass:"htmx-swapping",allowEval:true,allowScriptTags:true,inlineScriptNonce:"",attributesToSettle:["class","style","width","height"],withCredentials:false,timeout:0,wsReconnectDelay:"full-jitter",wsBinaryType:"blob",disableSelector:"[hx-disable], [data-hx-disable]",useTemplateFragments:false,scrollBehavior:"smooth",defaultFocusScroll:false,getCacheBusterParam:false,globalViewTransitions:false,methodsThatUseUrlParams:["get"],selfRequestsOnly:false},parseInterval:v,_:e,createEventSource:function(e){return new EventSource(e,{withCredentials:true})},createWebSocket:function(e){var t=new WebSocket(e,[]);t.binaryType=G.config.wsBinaryType;return t},version:"1.9.5"};var C={addTriggerHandler:bt,bodyContains:re,canAccessLocalStorage:M,findThisElement:he,filterValues:ar,hasAttribute:o,getAttributeValue:Z,getClosestAttributeValue:Y,getClosestMatch:c,getExpressionVars:gr,getHeaders:ir,getInputValues:er,getInternalData:ee,getSwapSpecification:sr,getTriggerSpecs:Ge,getTarget:de,makeFragment:l,mergeObjects:ne,makeSettleInfo:S,oobSwap:me,querySelectorExt:ie,selectAndSwap:De,settleImmediately:Wt,shouldCancel:Qe,triggerEvent:oe,triggerErrorEvent:ae,withExtensions:w};var R=["get","post","put","delete","patch"];var O=R.map(function(e){return"[hx-"+e+"], [data-hx-"+e+"]"}).join(", ");function v(e){if(e==undefined){return undefined}if(e.slice(-2)=="ms"){return parseFloat(e.slice(0,-2))||undefined}if(e.slice(-1)=="s"){return parseFloat(e.slice(0,-1))*1e3||undefined}if(e.slice(-1)=="m"){return parseFloat(e.slice(0,-1))*1e3*60||undefined}return parseFloat(e)||undefined}function J(e,t){return e.getAttribute&&e.getAttribute(t)}function o(e,t){return e.hasAttribute&&(e.hasAttribute(t)||e.hasAttribute("data-"+t))}function Z(e,t){return J(e,t)||J(e,"data-"+t)}function u(e){return e.parentElement}function K(){return document}function c(e,t){while(e&&!t(e)){e=u(e)}return e?e:null}function T(e,t,r){var n=Z(t,r);var i=Z(t,"hx-disinherit");if(e!==t&&i&&(i==="*"||i.split(" ").indexOf(r)>=0)){return"unset"}else{return n}}function Y(t,r){var n=null;c(t,function(e){return n=T(t,e,r)});if(n!=="unset"){return n}}function h(e,t){var r=e.matches||e.matchesSelector||e.msMatchesSelector||e.mozMatchesSelector||e.webkitMatchesSelector||e.oMatchesSelector;return r&&r.call(e,t)}function q(e){var t=/<([a-z][^\/\0>\x20\t\r\n\f]*)/i;var r=t.exec(e);if(r){return r[1].toLowerCase()}else{return""}}function i(e,t){var r=new DOMParser;var n=r.parseFromString(e,"text/html");var i=n.body;while(t>0){t--;i=i.firstChild}if(i==null){i=K().createDocumentFragment()}return i}function H(e){return e.match(/",0);return r.querySelector("template").content}else{var n=q(e);switch(n){case"thead":case"tbody":case"tfoot":case"colgroup":case"caption":return i(""+e+"
",1);case"col":return i(""+e+"
",2);case"tr":return i(""+e+"
",2);case"td":case"th":return i(""+e+"
",3);case"script":return i("
"+e+"
",1);default:return i(e,0)}}}function Q(e){if(e){e()}}function L(e,t){return Object.prototype.toString.call(e)==="[object "+t+"]"}function A(e){return L(e,"Function")}function N(e){return L(e,"Object")}function ee(e){var t="htmx-internal-data";var r=e[t];if(!r){r=e[t]={}}return r}function I(e){var t=[];if(e){for(var r=0;r=0}function re(e){if(e.getRootNode&&e.getRootNode()instanceof window.ShadowRoot){return K().body.contains(e.getRootNode().host)}else{return K().body.contains(e)}}function k(e){return e.trim().split(/\s+/)}function ne(e,t){for(var r in t){if(t.hasOwnProperty(r)){e[r]=t[r]}}return e}function y(e){try{return JSON.parse(e)}catch(e){x(e);return null}}function M(){var e="htmx:localStorageTest";try{localStorage.setItem(e,e);localStorage.removeItem(e);return true}catch(e){return false}}function D(t){try{var e=new URL(t);if(e){t=e.pathname+e.search}if(!t.match("^/$")){t=t.replace(/\/+$/,"")}return t}catch(e){return t}}function e(e){return hr(K().body,function(){return eval(e)})}function t(t){var e=G.on("htmx:load",function(e){t(e.detail.elt)});return e}function X(){G.logger=function(e,t,r){if(console){console.log(t,e,r)}}}function F(){G.logger=null}function b(e,t){if(t){return e.querySelector(t)}else{return b(K(),e)}}function f(e,t){if(t){return e.querySelectorAll(t)}else{return f(K(),e)}}function U(e,t){e=s(e);if(t){setTimeout(function(){U(e);e=null},t)}else{e.parentElement.removeChild(e)}}function B(e,t,r){e=s(e);if(r){setTimeout(function(){B(e,t);e=null},r)}else{e.classList&&e.classList.add(t)}}function n(e,t,r){e=s(e);if(r){setTimeout(function(){n(e,t);e=null},r)}else{if(e.classList){e.classList.remove(t);if(e.classList.length===0){e.removeAttribute("class")}}}}function V(e,t){e=s(e);e.classList.toggle(t)}function j(e,t){e=s(e);te(e.parentElement.children,function(e){n(e,t)});B(e,t)}function d(e,t){e=s(e);if(e.closest){return e.closest(t)}else{do{if(e==null||h(e,t)){return e}}while(e=e&&u(e));return null}}function r(e){var t=e.trim();if(t.startsWith("<")&&t.endsWith("/>")){return t.substring(1,t.length-2)}else{return t}}function W(e,t){if(t.indexOf("closest ")===0){return[d(e,r(t.substr(8)))]}else if(t.indexOf("find ")===0){return[b(e,r(t.substr(5)))]}else if(t.indexOf("next ")===0){return[_(e,r(t.substr(5)))]}else if(t.indexOf("previous ")===0){return[z(e,r(t.substr(9)))]}else if(t==="document"){return[document]}else if(t==="window"){return[window]}else if(t==="body"){return[document.body]}else{return K().querySelectorAll(r(t))}}var _=function(e,t){var r=K().querySelectorAll(t);for(var n=0;n=0;n--){var i=r[n];if(i.compareDocumentPosition(e)===Node.DOCUMENT_POSITION_FOLLOWING){return i}}};function ie(e,t){if(t){return W(e,t)[0]}else{return W(K().body,e)[0]}}function s(e){if(L(e,"String")){return b(e)}else{return e}}function $(e,t,r){if(A(t)){return{target:K().body,event:e,listener:t}}else{return{target:s(e),event:t,listener:r}}}function le(t,r,n){Hr(function(){var e=$(t,r,n);e.target.addEventListener(e.event,e.listener)});var e=A(r);return e?r:n}function ue(t,r,n){Hr(function(){var e=$(t,r,n);e.target.removeEventListener(e.event,e.listener)});return A(r)?r:n}var fe=K().createElement("output");function ce(e,t){var r=Y(e,t);if(r){if(r==="this"){return[he(e,t)]}else{var n=W(e,r);if(n.length===0){x('The selector "'+r+'" on '+t+" returned no matches!");return[fe]}else{return n}}}}function he(e,t){return c(e,function(e){return Z(e,t)!=null})}function de(e){var t=Y(e,"hx-target");if(t){if(t==="this"){return he(e,"hx-target")}else{return ie(e,t)}}else{var r=ee(e);if(r.boosted){return K().body}else{return e}}}function ve(e){var t=G.config.attributesToSettle;for(var r=0;r0){o=e.substr(0,e.indexOf(":"));t=e.substr(e.indexOf(":")+1,e.length)}else{o=e}var r=K().querySelectorAll(t);if(r){te(r,function(e){var t;var r=i.cloneNode(true);t=K().createDocumentFragment();t.appendChild(r);if(!pe(o,e)){t=r}var n={shouldSwap:true,target:e,fragment:t};if(!oe(e,"htmx:oobBeforeSwap",n))return;e=n.target;if(n["shouldSwap"]){ke(o,e,e,t,a)}te(a.elts,function(e){oe(e,"htmx:oobAfterSwap",n)})});i.parentNode.removeChild(i)}else{i.parentNode.removeChild(i);ae(K().body,"htmx:oobErrorNoTarget",{content:i})}return e}function xe(e,t,r){var n=Y(e,"hx-select-oob");if(n){var i=n.split(",");for(let e=0;e0){var r=t.replace("'","\\'");var n=e.tagName.replace(":","\\:");var i=o.querySelector(n+"[id='"+r+"']");if(i&&i!==o){var a=e.cloneNode();ge(e,i);s.tasks.push(function(){ge(e,a)})}}})}function we(e){return function(){n(e,G.config.addedClass);Nt(e);St(e);Se(e);oe(e,"htmx:load")}}function Se(e){var t="[autofocus]";var r=h(e,t)?e:e.querySelector(t);if(r!=null){r.focus()}}function a(e,t,r,n){be(e,r,n);while(r.childNodes.length>0){var i=r.firstChild;B(i,G.config.addedClass);e.insertBefore(i,t);if(i.nodeType!==Node.TEXT_NODE&&i.nodeType!==Node.COMMENT_NODE){n.tasks.push(we(i))}}}function Ee(e,t){var r=0;while(r-1){var t=e.replace(/]*>|>)([\s\S]*?)<\/svg>/gim,"");var r=t.match(/]*>|>)([\s\S]*?)<\/title>/im);if(r){return r[2]}}}function De(e,t,r,n,i,a){i.title=Me(n);var o=l(n);if(o){xe(r,o,i);o=Pe(r,o,a);ye(o);return ke(e,r,t,o,i)}}function Xe(e,t,r){var n=e.getResponseHeader(t);if(n.indexOf("{")===0){var i=y(n);for(var a in i){if(i.hasOwnProperty(a)){var o=i[a];if(!N(o)){o={value:o}}oe(r,a,o)}}}else{var s=n.split(",");for(var l=0;l0){var o=t[0];if(o==="]"){n--;if(n===0){if(a===null){i=i+"true"}t.shift();i+=")})";try{var s=hr(e,function(){return Function(i)()},function(){return true});s.source=i;return s}catch(e){ae(K().body,"htmx:syntax:error",{error:e,source:i});return null}}}else if(o==="["){n++}if(_e(o,a,r)){i+="(("+r+"."+o+") ? ("+r+"."+o+") : (window."+o+"))"}else{i=i+o}a=t.shift()}}}function m(e,t){var r="";while(e.length>0&&!e[0].match(t)){r+=e.shift()}return r}var $e="input, textarea, select";function Ge(e){var t=Z(e,"hx-trigger");var r=[];if(t){var n=We(t);do{m(n,je);var i=n.length;var a=m(n,/[,\[\s]/);if(a!==""){if(a==="every"){var o={trigger:"every"};m(n,je);o.pollInterval=v(m(n,/[,\[\s]/));m(n,je);var s=ze(e,n,"event");if(s){o.eventFilter=s}r.push(o)}else if(a.indexOf("sse:")===0){r.push({trigger:"sse",sseEvent:a.substr(4)})}else{var l={trigger:a};var s=ze(e,n,"event");if(s){l.eventFilter=s}while(n.length>0&&n[0]!==","){m(n,je);var u=n.shift();if(u==="changed"){l.changed=true}else if(u==="once"){l.once=true}else if(u==="consume"){l.consume=true}else if(u==="delay"&&n[0]===":"){n.shift();l.delay=v(m(n,p))}else if(u==="from"&&n[0]===":"){n.shift();var f=m(n,p);if(f==="closest"||f==="find"||f==="next"||f==="previous"){n.shift();f+=" "+m(n,p)}l.from=f}else if(u==="target"&&n[0]===":"){n.shift();l.target=m(n,p)}else if(u==="throttle"&&n[0]===":"){n.shift();l.throttle=v(m(n,p))}else if(u==="queue"&&n[0]===":"){n.shift();l.queue=m(n,p)}else if((u==="root"||u==="threshold")&&n[0]===":"){n.shift();l[u]=m(n,p)}else{ae(e,"htmx:syntax:error",{token:n.shift()})}}r.push(l)}}if(n.length===i){ae(e,"htmx:syntax:error",{token:n.shift()})}m(n,je)}while(n[0]===","&&n.shift())}if(r.length>0){return r}else if(h(e,"form")){return[{trigger:"submit"}]}else if(h(e,'input[type="button"], input[type="submit"]')){return[{trigger:"click"}]}else if(h(e,$e)){return[{trigger:"change"}]}else{return[{trigger:"click"}]}}function Je(e){ee(e).cancelled=true}function Ze(e,t,r){var n=ee(e);n.timeout=setTimeout(function(){if(re(e)&&n.cancelled!==true){if(!tt(r,e,Pt("hx:poll:trigger",{triggerSpec:r,target:e}))){t(e)}Ze(e,t,r)}},r.pollInterval)}function Ke(e){return location.hostname===e.hostname&&J(e,"href")&&J(e,"href").indexOf("#")!==0}function Ye(t,r,e){if(t.tagName==="A"&&Ke(t)&&(t.target===""||t.target==="_self")||t.tagName==="FORM"){r.boosted=true;var n,i;if(t.tagName==="A"){n="get";i=t.href}else{var a=J(t,"method");n=a?a.toLowerCase():"get";if(n==="get"){}i=J(t,"action")}e.forEach(function(e){rt(t,function(e,t){if(d(e,G.config.disableSelector)){g(e);return}se(n,i,e,t)},r,e,true)})}}function Qe(e,t){if(e.type==="submit"||e.type==="click"){if(t.tagName==="FORM"){return true}if(h(t,'input[type="submit"], button')&&d(t,"form")!==null){return true}if(t.tagName==="A"&&t.href&&(t.getAttribute("href")==="#"||t.getAttribute("href").indexOf("#")!==0)){return true}}return false}function et(e,t){return ee(e).boosted&&e.tagName==="A"&&t.type==="click"&&(t.ctrlKey||t.metaKey)}function tt(e,t,r){var n=e.eventFilter;if(n){try{return n.call(t,r)!==true}catch(e){ae(K().body,"htmx:eventFilter:error",{error:e,source:n.source});return true}}return false}function rt(a,o,e,s,l){var u=ee(a);var t;if(s.from){t=W(a,s.from)}else{t=[a]}if(s.changed){t.forEach(function(e){var t=ee(e);t.lastValue=e.value})}te(t,function(n){var i=function(e){if(!re(a)){n.removeEventListener(s.trigger,i);return}if(et(a,e)){return}if(l||Qe(e,a)){e.preventDefault()}if(tt(s,a,e)){return}var t=ee(e);t.triggerSpec=s;if(t.handledFor==null){t.handledFor=[]}if(t.handledFor.indexOf(a)<0){t.handledFor.push(a);if(s.consume){e.stopPropagation()}if(s.target&&e.target){if(!h(e.target,s.target)){return}}if(s.once){if(u.triggeredOnce){return}else{u.triggeredOnce=true}}if(s.changed){var r=ee(n);if(r.lastValue===n.value){return}r.lastValue=n.value}if(u.delayed){clearTimeout(u.delayed)}if(u.throttle){return}if(s.throttle){if(!u.throttle){o(a,e);u.throttle=setTimeout(function(){u.throttle=null},s.throttle)}}else if(s.delay){u.delayed=setTimeout(function(){o(a,e)},s.delay)}else{oe(a,"htmx:trigger");o(a,e)}}};if(e.listenerInfos==null){e.listenerInfos=[]}e.listenerInfos.push({trigger:s.trigger,listener:i,on:n});n.addEventListener(s.trigger,i)})}var nt=false;var it=null;function at(){if(!it){it=function(){nt=true};window.addEventListener("scroll",it);setInterval(function(){if(nt){nt=false;te(K().querySelectorAll("[hx-trigger='revealed'],[data-hx-trigger='revealed']"),function(e){ot(e)})}},200)}}function ot(t){if(!o(t,"data-hx-revealed")&&P(t)){t.setAttribute("data-hx-revealed","true");var e=ee(t);if(e.initHash){oe(t,"revealed")}else{t.addEventListener("htmx:afterProcessNode",function(e){oe(t,"revealed")},{once:true})}}}function st(e,t,r){var n=k(r);for(var i=0;i=0){var t=ct(n);setTimeout(function(){lt(s,r,n+1)},t)}};t.onopen=function(e){n=0};ee(s).webSocket=t;t.addEventListener("message",function(e){if(ut(s)){return}var t=e.data;w(s,function(e){t=e.transformResponse(t,null,s)});var r=S(s);var n=l(t);var i=I(n.children);for(var a=0;a0){oe(u,"htmx:validation:halted",i);return}t.send(JSON.stringify(l));if(Qe(e,u)){e.preventDefault()}})}else{ae(u,"htmx:noWebSocketSourceError")}}function ct(e){var t=G.config.wsReconnectDelay;if(typeof t==="function"){return t(e)}if(t==="full-jitter"){var r=Math.min(e,6);var n=1e3*Math.pow(2,r);return n*Math.random()}x('htmx.config.wsReconnectDelay must either be a function or the string "full-jitter"')}function ht(e,t,r){var n=k(r);for(var i=0;i0){var o=n.shift();var s=o.match(/^\s*([a-zA-Z:\-]+:)(.*)/);if(a===0&&s){o.split(":");i=s[1].slice(0,-1);r[i]=s[2]}else{r[i]+=o}a+=Tt(o)}for(var l in r){qt(e,l,r[l])}}}function Lt(t){Re(t);for(var e=0;eG.config.historyCacheSize){i.shift()}while(i.length>0){try{localStorage.setItem("htmx-history-cache",JSON.stringify(i));break}catch(e){ae(K().body,"htmx:historyCacheError",{cause:e,cache:i});i.shift()}}}function Ft(e){if(!M()){return null}e=D(e);var t=y(localStorage.getItem("htmx-history-cache"))||[];for(var r=0;r=200&&this.status<400){oe(K().body,"htmx:historyCacheMissLoad",o);var e=l(this.response);e=e.querySelector("[hx-history-elt],[data-hx-history-elt]")||e;var t=Dt();var r=S(t);var n=Me(this.response);if(n){var i=b("title");if(i){i.innerHTML=n}else{window.document.title=n}}Ie(t,e,r);Wt(r.tasks);Mt=a;oe(K().body,"htmx:historyRestore",{path:a,cacheMiss:true,serverResponse:this.response})}else{ae(K().body,"htmx:historyCacheMissLoadError",o)}};e.send()}function zt(e){Bt();e=e||location.pathname+location.search;var t=Ft(e);if(t){var r=l(t.content);var n=Dt();var i=S(n);Ie(n,r,i);Wt(i.tasks);document.title=t.title;setTimeout(function(){window.scrollTo(0,t.scroll)},0);Mt=e;oe(K().body,"htmx:historyRestore",{path:e,item:t})}else{if(G.config.refreshOnHistoryMiss){window.location.reload(true)}else{_t(e)}}}function $t(e){var t=ce(e,"hx-indicator");if(t==null){t=[e]}te(t,function(e){var t=ee(e);t.requestCount=(t.requestCount||0)+1;e.classList["add"].call(e.classList,G.config.requestClass)});return t}function Gt(e){te(e,function(e){var t=ee(e);t.requestCount=(t.requestCount||0)-1;if(t.requestCount===0){e.classList["remove"].call(e.classList,G.config.requestClass)}})}function Jt(e,t){for(var r=0;r=0}function sr(e,t){var r=t?t:Y(e,"hx-swap");var n={swapStyle:ee(e).boosted?"innerHTML":G.config.defaultSwapStyle,swapDelay:G.config.defaultSwapDelay,settleDelay:G.config.defaultSettleDelay};if(ee(e).boosted&&!or(e)){n["show"]="top"}if(r){var i=k(r);if(i.length>0){n["swapStyle"]=i[0];for(var a=1;a0?l.join(":"):null;n["scroll"]=u;n["scrollTarget"]=f}if(o.indexOf("show:")===0){var c=o.substr(5);var l=c.split(":");var h=l.pop();var f=l.length>0?l.join(":"):null;n["show"]=h;n["showTarget"]=f}if(o.indexOf("focus-scroll:")===0){var d=o.substr("focus-scroll:".length);n["focusScroll"]=d=="true"}}}}return n}function lr(e){return Y(e,"hx-encoding")==="multipart/form-data"||h(e,"form")&&J(e,"enctype")==="multipart/form-data"}function ur(t,r,n){var i=null;w(r,function(e){if(i==null){i=e.encodeParameters(t,n,r)}});if(i!=null){return i}else{if(lr(r)){return nr(n)}else{return rr(n)}}}function S(e){return{tasks:[],elts:[e]}}function fr(e,t){var r=e[0];var n=e[e.length-1];if(t.scroll){var i=null;if(t.scrollTarget){i=ie(r,t.scrollTarget)}if(t.scroll==="top"&&(r||i)){i=i||r;i.scrollTop=0}if(t.scroll==="bottom"&&(n||i)){i=i||n;i.scrollTop=i.scrollHeight}}if(t.show){var i=null;if(t.showTarget){var a=t.showTarget;if(t.showTarget==="window"){a="body"}i=ie(r,a)}if(t.show==="top"&&(r||i)){i=i||r;i.scrollIntoView({block:"start",behavior:G.config.scrollBehavior})}if(t.show==="bottom"&&(n||i)){i=i||n;i.scrollIntoView({block:"end",behavior:G.config.scrollBehavior})}}}function cr(e,t,r,n){if(n==null){n={}}if(e==null){return n}var i=Z(e,t);if(i){var a=i.trim();var o=r;if(a==="unset"){return null}if(a.indexOf("javascript:")===0){a=a.substr(11);o=true}else if(a.indexOf("js:")===0){a=a.substr(3);o=true}if(a.indexOf("{")!==0){a="{"+a+"}"}var s;if(o){s=hr(e,function(){return Function("return ("+a+")")()},{})}else{s=y(a)}for(var l in s){if(s.hasOwnProperty(l)){if(n[l]==null){n[l]=s[l]}}}}return cr(u(e),t,r,n)}function hr(e,t,r){if(G.config.allowEval){return t()}else{ae(e,"htmx:evalDisallowedError");return r}}function dr(e,t){return cr(e,"hx-vars",true,t)}function vr(e,t){return cr(e,"hx-vals",false,t)}function gr(e){return ne(dr(e),vr(e))}function pr(t,r,n){if(n!==null){try{t.setRequestHeader(r,n)}catch(e){t.setRequestHeader(r,encodeURIComponent(n));t.setRequestHeader(r+"-URI-AutoEncoded","true")}}}function mr(t){if(t.responseURL&&typeof URL!=="undefined"){try{var e=new URL(t.responseURL);return e.pathname+e.search}catch(e){ae(K().body,"htmx:badResponseUrl",{url:t.responseURL})}}}function E(e,t){return e.getAllResponseHeaders().match(t)}function xr(e,t,r){e=e.toLowerCase();if(r){if(r instanceof Element||L(r,"String")){return se(e,t,null,null,{targetOverride:s(r),returnPromise:true})}else{return se(e,t,s(r.source),r.event,{handler:r.handler,headers:r.headers,values:r.values,targetOverride:s(r.target),swapOverride:r.swap,returnPromise:true})}}else{return se(e,t,null,null,{returnPromise:true})}}function yr(e){var t=[];while(e){t.push(e);e=e.parentElement}return t}function br(e,t,r){var n=new URL(t,document.location.href);var i=document.location.origin;var a=i===n.origin;if(G.config.selfRequestsOnly){if(!a){return false}}return oe(e,"htmx:validateUrl",ne({url:n,sameHost:a},r))}function se(e,t,n,r,i,M){var a=null;var o=null;i=i!=null?i:{};if(i.returnPromise&&typeof Promise!=="undefined"){var s=new Promise(function(e,t){a=e;o=t})}if(n==null){n=K().body}var D=i.handler||Sr;if(!re(n)){return}var l=i.targetOverride||de(n);if(l==null||l==fe){ae(n,"htmx:targetError",{target:Z(n,"hx-target")});return}if(!M){var X=function(){return se(e,t,n,r,i,true)};var F={target:l,elt:n,path:t,verb:e,triggeringEvent:r,etc:i,issueRequest:X};if(oe(n,"htmx:confirm",F)===false){return}}var u=n;var f=ee(n);var c=Y(n,"hx-sync");var h=null;var d=false;if(c){var v=c.split(":");var g=v[0].trim();if(g==="this"){u=he(n,"hx-sync")}else{u=ie(n,g)}c=(v[1]||"drop").trim();f=ee(u);if(c==="drop"&&f.xhr&&f.abortable!==true){return}else if(c==="abort"){if(f.xhr){return}else{d=true}}else if(c==="replace"){oe(u,"htmx:abort")}else if(c.indexOf("queue")===0){var U=c.split(" ");h=(U[1]||"last").trim()}}if(f.xhr){if(f.abortable){oe(u,"htmx:abort")}else{if(h==null){if(r){var p=ee(r);if(p&&p.triggerSpec&&p.triggerSpec.queue){h=p.triggerSpec.queue}}if(h==null){h="last"}}if(f.queuedRequests==null){f.queuedRequests=[]}if(h==="first"&&f.queuedRequests.length===0){f.queuedRequests.push(function(){se(e,t,n,r,i)})}else if(h==="all"){f.queuedRequests.push(function(){se(e,t,n,r,i)})}else if(h==="last"){f.queuedRequests=[];f.queuedRequests.push(function(){se(e,t,n,r,i)})}return}}var m=new XMLHttpRequest;f.xhr=m;f.abortable=d;var x=function(){f.xhr=null;f.abortable=false;if(f.queuedRequests!=null&&f.queuedRequests.length>0){var e=f.queuedRequests.shift();e()}};var y=Y(n,"hx-prompt");if(y){var b=prompt(y);if(b===null||!oe(n,"htmx:prompt",{prompt:b,target:l})){Q(a);x();return s}}var w=Y(n,"hx-confirm");if(w){if(!confirm(w)){Q(a);x();return s}}var S=ir(n,l,b);if(i.headers){S=ne(S,i.headers)}var E=er(n,e);var C=E.errors;var R=E.values;if(i.values){R=ne(R,i.values)}var B=gr(n);var O=ne(R,B);var T=ar(O,n);if(e!=="get"&&!lr(n)){S["Content-Type"]="application/x-www-form-urlencoded"}if(G.config.getCacheBusterParam&&e==="get"){T["org.htmx.cache-buster"]=J(l,"id")||"true"}if(t==null||t===""){t=K().location.href}var q=cr(n,"hx-request");var V=ee(n).boosted;var H=G.config.methodsThatUseUrlParams.indexOf(e)>=0;var L={boosted:V,useUrlParams:H,parameters:T,unfilteredParameters:O,headers:S,target:l,verb:e,errors:C,withCredentials:i.credentials||q.credentials||G.config.withCredentials,timeout:i.timeout||q.timeout||G.config.timeout,path:t,triggeringEvent:r};if(!oe(n,"htmx:configRequest",L)){Q(a);x();return s}t=L.path;e=L.verb;S=L.headers;T=L.parameters;C=L.errors;H=L.useUrlParams;if(C&&C.length>0){oe(n,"htmx:validation:halted",L);Q(a);x();return s}var j=t.split("#");var W=j[0];var A=j[1];var N=t;if(H){N=W;var _=Object.keys(T).length!==0;if(_){if(N.indexOf("?")<0){N+="?"}else{N+="&"}N+=rr(T);if(A){N+="#"+A}}}if(!br(n,N,L)){ae(n,"htmx:invalidPath",L);return}m.open(e.toUpperCase(),N,true);m.overrideMimeType("text/html");m.withCredentials=L.withCredentials;m.timeout=L.timeout;if(q.noHeaders){}else{for(var I in S){if(S.hasOwnProperty(I)){var z=S[I];pr(m,I,z)}}}var P={xhr:m,target:l,requestConfig:L,etc:i,boosted:V,pathInfo:{requestPath:t,finalRequestPath:N,anchor:A}};m.onload=function(){try{var e=yr(n);P.pathInfo.responsePath=mr(m);D(n,P);Gt(k);oe(n,"htmx:afterRequest",P);oe(n,"htmx:afterOnLoad",P);if(!re(n)){var t=null;while(e.length>0&&t==null){var r=e.shift();if(re(r)){t=r}}if(t){oe(t,"htmx:afterRequest",P);oe(t,"htmx:afterOnLoad",P)}}Q(a);x()}catch(e){ae(n,"htmx:onLoadError",ne({error:e},P));throw e}};m.onerror=function(){Gt(k);ae(n,"htmx:afterRequest",P);ae(n,"htmx:sendError",P);Q(o);x()};m.onabort=function(){Gt(k);ae(n,"htmx:afterRequest",P);ae(n,"htmx:sendAbort",P);Q(o);x()};m.ontimeout=function(){Gt(k);ae(n,"htmx:afterRequest",P);ae(n,"htmx:timeout",P);Q(o);x()};if(!oe(n,"htmx:beforeRequest",P)){Q(a);x();return s}var k=$t(n);te(["loadstart","loadend","progress","abort"],function(t){te([m,m.upload],function(e){e.addEventListener(t,function(e){oe(n,"htmx:xhr:"+t,{lengthComputable:e.lengthComputable,loaded:e.loaded,total:e.total})})})});oe(n,"htmx:beforeSend",P);var $=H?null:ur(m,n,T);m.send($);return s}function wr(e,t){var r=t.xhr;var n=null;var i=null;if(E(r,/HX-Push:/i)){n=r.getResponseHeader("HX-Push");i="push"}else if(E(r,/HX-Push-Url:/i)){n=r.getResponseHeader("HX-Push-Url");i="push"}else if(E(r,/HX-Replace-Url:/i)){n=r.getResponseHeader("HX-Replace-Url");i="replace"}if(n){if(n==="false"){return{}}else{return{type:i,path:n}}}var a=t.pathInfo.finalRequestPath;var o=t.pathInfo.responsePath;var s=Y(e,"hx-push-url");var l=Y(e,"hx-replace-url");var u=ee(e).boosted;var f=null;var c=null;if(s){f="push";c=s}else if(l){f="replace";c=l}else if(u){f="push";c=o||a}if(c){if(c==="false"){return{}}if(c==="true"){c=o||a}if(t.pathInfo.anchor&&c.indexOf("#")===-1){c=c+"#"+t.pathInfo.anchor}return{type:f,path:c}}else{return{}}}function Sr(l,u){var f=u.xhr;var c=u.target;var e=u.etc;if(!oe(l,"htmx:beforeOnLoad",u))return;if(E(f,/HX-Trigger:/i)){Xe(f,"HX-Trigger",l)}if(E(f,/HX-Location:/i)){Bt();var t=f.getResponseHeader("HX-Location");var h;if(t.indexOf("{")===0){h=y(t);t=h["path"];delete h["path"]}xr("GET",t,h).then(function(){Vt(t)});return}if(E(f,/HX-Redirect:/i)){location.href=f.getResponseHeader("HX-Redirect");return}if(E(f,/HX-Refresh:/i)){if("true"===f.getResponseHeader("HX-Refresh")){location.reload();return}}if(E(f,/HX-Retarget:/i)){u.target=K().querySelector(f.getResponseHeader("HX-Retarget"))}var d=wr(l,u);var r=f.status>=200&&f.status<400&&f.status!==204;var v=f.response;var n=f.status>=400;var i=ne({shouldSwap:r,serverResponse:v,isError:n},u);if(!oe(c,"htmx:beforeSwap",i))return;c=i.target;v=i.serverResponse;n=i.isError;u.target=c;u.failed=n;u.successful=!n;if(i.shouldSwap){if(f.status===286){Je(l)}w(l,function(e){v=e.transformResponse(v,f,l)});if(d.type){Bt()}var a=e.swapOverride;if(E(f,/HX-Reswap:/i)){a=f.getResponseHeader("HX-Reswap")}var h=sr(l,a);c.classList.add(G.config.swappingClass);var g=null;var p=null;var o=function(){try{var e=document.activeElement;var t={};try{t={elt:e,start:e?e.selectionStart:null,end:e?e.selectionEnd:null}}catch(e){}var r;if(E(f,/HX-Reselect:/i)){r=f.getResponseHeader("HX-Reselect")}var n=S(c);De(h.swapStyle,c,l,v,n,r);if(t.elt&&!re(t.elt)&&J(t.elt,"id")){var i=document.getElementById(J(t.elt,"id"));var a={preventScroll:h.focusScroll!==undefined?!h.focusScroll:!G.config.defaultFocusScroll};if(i){if(t.start&&i.setSelectionRange){try{i.setSelectionRange(t.start,t.end)}catch(e){}}i.focus(a)}}c.classList.remove(G.config.swappingClass);te(n.elts,function(e){if(e.classList){e.classList.add(G.config.settlingClass)}oe(e,"htmx:afterSwap",u)});if(E(f,/HX-Trigger-After-Swap:/i)){var o=l;if(!re(l)){o=K().body}Xe(f,"HX-Trigger-After-Swap",o)}var s=function(){te(n.tasks,function(e){e.call()});te(n.elts,function(e){if(e.classList){e.classList.remove(G.config.settlingClass)}oe(e,"htmx:afterSettle",u)});if(d.type){if(d.type==="push"){Vt(d.path);oe(K().body,"htmx:pushedIntoHistory",{path:d.path})}else{jt(d.path);oe(K().body,"htmx:replacedInHistory",{path:d.path})}}if(u.pathInfo.anchor){var e=b("#"+u.pathInfo.anchor);if(e){e.scrollIntoView({block:"start",behavior:"auto"})}}if(n.title){var t=b("title");if(t){t.innerHTML=n.title}else{window.document.title=n.title}}fr(n.elts,h);if(E(f,/HX-Trigger-After-Settle:/i)){var r=l;if(!re(l)){r=K().body}Xe(f,"HX-Trigger-After-Settle",r)}Q(g)};if(h.settleDelay>0){setTimeout(s,h.settleDelay)}else{s()}}catch(e){ae(l,"htmx:swapError",u);Q(p);throw e}};var s=G.config.globalViewTransitions;if(h.hasOwnProperty("transition")){s=h.transition}if(s&&oe(l,"htmx:beforeTransition",u)&&typeof Promise!=="undefined"&&document.startViewTransition){var m=new Promise(function(e,t){g=e;p=t});var x=o;o=function(){document.startViewTransition(function(){x();return m})}}if(h.swapDelay>0){setTimeout(o,h.swapDelay)}else{o()}}if(n){ae(l,"htmx:responseError",ne({error:"Response Status Error Code "+f.status+" from "+u.pathInfo.requestPath},u))}}var Er={};function Cr(){return{init:function(e){return null},onEvent:function(e,t){return true},transformResponse:function(e,t,r){return e},isInlineSwap:function(e){return false},handleSwap:function(e,t,r,n){return false},encodeParameters:function(e,t,r){return null}}}function Rr(e,t){if(t.init){t.init(C)}Er[e]=ne(Cr(),t)}function Or(e){delete Er[e]}function Tr(e,r,n){if(e==undefined){return r}if(r==undefined){r=[]}if(n==undefined){n=[]}var t=Z(e,"hx-ext");if(t){te(t.split(","),function(e){e=e.replace(/ /g,"");if(e.slice(0,7)=="ignore:"){n.push(e.slice(7));return}if(n.indexOf(e)<0){var t=Er[e];if(t&&r.indexOf(t)<0){r.push(t)}}})}return Tr(u(e),r,n)}var qr=false;K().addEventListener("DOMContentLoaded",function(){qr=true});function Hr(e){if(qr||K().readyState==="complete"){e()}else{K().addEventListener("DOMContentLoaded",e)}}function Lr(){if(G.config.includeIndicatorStyles!==false){K().head.insertAdjacentHTML("beforeend","")}}function Ar(){var e=K().querySelector('meta[name="htmx-config"]');if(e){return y(e.content)}else{return null}}function Nr(){var e=Ar();if(e){G.config=ne(G.config,e)}}Hr(function(){Nr();Lr();var e=K().body;Nt(e);var t=K().querySelectorAll("[hx-trigger='restored'],[data-hx-trigger='restored']");e.addEventListener("htmx:abort",function(e){var t=e.target;var r=ee(t);if(r&&r.xhr){r.xhr.abort()}});var r=window.onpopstate;window.onpopstate=function(e){if(e.state&&e.state.htmx){zt();te(t,function(e){oe(e,"htmx:restored",{document:K(),triggerEvent:oe})})}else{if(r){r(e)}}};setTimeout(function(){oe(e,"htmx:load",{});e=null},0)});return G}()}); diff --git a/webcontent/js/membreid-selected-and-cleared.js b/webcontent/js/membreid-selected-and-cleared.js new file mode 100644 index 0000000..207141e --- /dev/null +++ b/webcontent/js/membreid-selected-and-cleared.js @@ -0,0 +1,14 @@ +function clearInput(inputId) { + document.getElementById(inputId).value = ''; +}; + +function focusInput(inputId) { + document.getElementById(inputId).focus(); +}; + +window.onload = function() { + inputId = "membre_id"; + + clearInput(inputId); + focusInput(inputId); +}; diff --git a/webcontent/webcontent.go b/webcontent/webcontent.go index 135e4fe..d952011 100644 --- a/webcontent/webcontent.go +++ b/webcontent/webcontent.go @@ -12,13 +12,20 @@ import ( "github.com/labstack/echo/v4" ) -//go:embed html/*html +//go:embed html/*.html var htmlFS embed.FS +//go:embed js/*.js +var publicFS embed.FS + func HTMLFS() embed.FS { return htmlFS } +func PublicFS() embed.FS { + return publicFS +} + type Template struct { templates *template.Template } diff --git a/webhandler/webhandler.go b/webhandler/webhandler.go index 006f5fe..36cff22 100644 --- a/webhandler/webhandler.go +++ b/webhandler/webhandler.go @@ -2,21 +2,27 @@ package webhandler import ( + "log" "net/http" + "git.agecem.com/agecem/bottin-ag/apiclient" "git.agecem.com/agecem/bottin-ag/webresponse" "github.com/labstack/echo/v4" ) func DeclareRoutes(e *echo.Echo, h *WebHandler) { e.GET("/", h.IndexGET) + e.POST("/scan/", h.ScanPOST) } type WebHandler struct { + APIClient *apiclient.APIClient } -func New() WebHandler { - return WebHandler{} +func New(apiClient *apiclient.APIClient) WebHandler { + return WebHandler{ + APIClient: apiClient, + } } func (w *WebHandler) IndexGET(c echo.Context) error { @@ -27,3 +33,24 @@ func (w *WebHandler) IndexGET(c echo.Context) error { return c.Render(r.StatusCode, "index-html", r) } + +func (w *WebHandler) ScanPOST(c echo.Context) error { + var r webresponse.ScanPOST + + membreID := c.FormValue("membre_id") + + //TODO + log.Println("membreID:", membreID) + + r.StatusCode = http.StatusOK + + scanResponse, err := w.APIClient.Scan(membreID) + r.Error = scanResponse.Error + if err != nil { + r.Error = err.Error() + } + + r.Message = scanResponse.Message + + return c.Render(r.StatusCode, "scan-html", r) +} diff --git a/webresponse/webresponse.go b/webresponse/webresponse.go index 88289ba..8d7491a 100644 --- a/webresponse/webresponse.go +++ b/webresponse/webresponse.go @@ -5,3 +5,7 @@ import "git.agecem.com/agecem/bottin-ag/apiresponse" type IndexGET struct { apiresponse.Response } + +type ScanPOST struct { + apiresponse.Response +} From 2da8e181e8ebfeaaccf8cdd56b34c7b1d303a0eb Mon Sep 17 00:00:00 2001 From: Victor Lacasse-Beaudoin Date: Sun, 17 Sep 2023 16:39:54 -0400 Subject: [PATCH 39/55] =?UTF-8?q?Ajouter=20emojis=20pour=20clarifier=20r?= =?UTF-8?q?=C3=A9sultat=20de=20scan=20web?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- apihandler/apihandler.go | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/apihandler/apihandler.go b/apihandler/apihandler.go index a584e8a..634cae5 100644 --- a/apihandler/apihandler.go +++ b/apihandler/apihandler.go @@ -114,7 +114,7 @@ func (a *APIHandler) ScanPOST(c echo.Context) error { if err != nil { switch err.Error() { case "Ce numéro étudiant ne correspond à aucunE membre": - r.Message = fmt.Sprintf("%s n'est pas membre de l'AGECEM", membreID) + r.Message = fmt.Sprintf("👎 %s n'est pas membre de l'AGECEM", membreID) r.Error = err.Error() r.StatusCode = http.StatusNotFound @@ -149,7 +149,7 @@ func (a *APIHandler) ScanPOST(c echo.Context) error { insertedPresence, err := a.DBClient.InsertPresence(presence) if err != nil { r.Error = err.Error() - r.Message = "Erreur lors de DBClient.InsertPresence" + r.Message = "👎 Erreur lors de DBClient.InsertPresence" r.StatusCode = http.StatusInternalServerError return c.JSON(r.StatusCode, r) @@ -157,14 +157,14 @@ func (a *APIHandler) ScanPOST(c echo.Context) error { if insertedPresence.ID == "" { r.Error = "Membre déjà enregistré·e" - r.Message = fmt.Sprintf("Membre '%s' (%s) déjà enregistré·e.", presence.Name, presence.ID) + r.Message = fmt.Sprintf("👎 Membre '%s' (%s) déjà enregistré·e.", presence.Name, presence.ID) r.StatusCode = http.StatusBadRequest return c.JSON(r.StatusCode, r) } r.StatusCode = http.StatusOK - r.Message = fmt.Sprintf("Membre '%s' (%s) enregistré·e avec succès, veuillez lui donner son carton de vote. Bonne assemblée!", insertedPresence.Name, insertedPresence.ID) + r.Message = fmt.Sprintf("👍 Membre '%s' (%s) enregistré·e avec succès, veuillez lui donner son carton de vote. Bonne assemblée!", insertedPresence.Name, insertedPresence.ID) return c.JSON(r.StatusCode, r) } From 78ea51e2c5e041d2471279c0f4a607646fe386a5 Mon Sep 17 00:00:00 2001 From: Victor Lacasse-Beaudoin Date: Mon, 18 Sep 2023 18:34:53 -0400 Subject: [PATCH 40/55] =?UTF-8?q?Migrer=20client=20API=20=C3=A0=20voki?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- apiclient/apiclient.go | 80 ++---------------------------------------- cmd/web.go | 8 ++++- go.mod | 3 +- go.sum | 2 ++ 4 files changed, 14 insertions(+), 79 deletions(-) diff --git a/apiclient/apiclient.go b/apiclient/apiclient.go index d68b7ad..95992b8 100644 --- a/apiclient/apiclient.go +++ b/apiclient/apiclient.go @@ -2,92 +2,18 @@ package apiclient import ( - "encoding/json" "fmt" - "io" "net/http" + "codeberg.org/vlbeaudoin/voki" "git.agecem.com/agecem/bottin-ag/apiresponse" ) type APIClient struct { - Key string - Host string - Port int - Protocol string -} - -func New(key, host, protocol string, port int) *APIClient { - return &APIClient{ - Key: key, - Host: host, - Port: port, - Protocol: protocol, - } -} - -// Makes APIClient.Call() returning only an error. The Call data is put into the responder parameter's reference -func (a *APIClient) CallResponder(method, route string, requestBody io.Reader, useKey bool, responder apiresponse.Responder) error { - callResponse, err := a.Call(method, route, requestBody, useKey) - if err != nil { - return err - } - defer callResponse.Body.Close() - - body, err := io.ReadAll(callResponse.Body) - if err != nil { - return err - } - - err = json.Unmarshal(body, responder) - if err != nil { - return err - } - - return nil -} - -func (a *APIClient) Call(method, route string, requestBody io.Reader, useKey bool) (*http.Response, error) { - var response *http.Response - - endpoint := fmt.Sprintf("%s://%s:%d%s", - a.Protocol, a.Host, a.Port, route, - ) - - // Create client - client := &http.Client{} - - // Create request - request, err := http.NewRequest(method, endpoint, requestBody) - if err != nil { - return response, err - } - - if useKey { - if a.Key == "" { - return response, fmt.Errorf("Call to API required a key but none was provided. See --help for instructions on providing an API key.") - } - - request.Header.Add("Authorization", fmt.Sprintf("Bearer %s", a.Key)) - } - - if requestBody != nil { - request.Header.Add("Content-Type", "application/json") - } - - // Fetch Request - response, err = client.Do(request) - if err != nil { - return response, err - } - - return response, nil + Voki *voki.Voki } func (a *APIClient) Scan(membreID string) (response apiresponse.ScanPOST, err error) { //TODO implement api key - //err = a.CallResponder(http.MethodPost, "/v0/scan", &buf, true, &response) - err = a.CallResponder(http.MethodPost, fmt.Sprintf("/v0/scan/%s", membreID), nil, false, &response) - - return + return response, a.Voki.Unmarshal(http.MethodPost, fmt.Sprintf("/v0/scan/%s", membreID), nil, false, &response) } diff --git a/cmd/web.go b/cmd/web.go index 7f580f0..0706774 100644 --- a/cmd/web.go +++ b/cmd/web.go @@ -8,6 +8,7 @@ import ( "log" "net/http" + "codeberg.org/vlbeaudoin/voki" "git.agecem.com/agecem/bottin-ag/apiclient" "git.agecem.com/agecem/bottin-ag/config" "git.agecem.com/agecem/bottin-ag/webcontent" @@ -33,7 +34,12 @@ var webCmd = &cobra.Command{ e.Pre(middleware.AddTrailingSlash()) - apiClient := apiclient.New(cfg.Web.API.Key, cfg.Web.API.Host, cfg.Web.API.Protocol, cfg.Web.API.Port) + client := http.DefaultClient + defer client.CloseIdleConnections() + + apiClient := &apiclient.APIClient{ + Voki: voki.New(client, cfg.Web.API.Host, cfg.Web.API.Key, cfg.Web.API.Port, cfg.Web.API.Protocol), + } handler := webhandler.New(apiClient) diff --git a/go.mod b/go.mod index d9a5233..946e796 100644 --- a/go.mod +++ b/go.mod @@ -3,7 +3,9 @@ module git.agecem.com/agecem/bottin-ag go 1.21.0 require ( + codeberg.org/vlbeaudoin/voki v1.1.2 git.agecem.com/agecem/bottin/v5 v5.3.0 + github.com/jmoiron/sqlx v1.3.5 github.com/labstack/echo/v4 v4.11.1 github.com/spf13/cobra v1.7.0 github.com/spf13/viper v1.16.0 @@ -15,7 +17,6 @@ require ( github.com/hashicorp/hcl v1.0.0 // indirect github.com/inconshreveable/mousetrap v1.1.0 // indirect github.com/jackc/pgx v3.6.2+incompatible // indirect - github.com/jmoiron/sqlx v1.3.5 // indirect github.com/labstack/gommon v0.4.0 // indirect github.com/magiconair/properties v1.8.7 // indirect github.com/mattn/go-colorable v0.1.13 // indirect diff --git a/go.sum b/go.sum index ee41114..6c9a2ed 100644 --- a/go.sum +++ b/go.sum @@ -35,6 +35,8 @@ cloud.google.com/go/storage v1.6.0/go.mod h1:N7U0C8pVQ/+NIKOBQyamJIeKQKkZ+mxpohl cloud.google.com/go/storage v1.8.0/go.mod h1:Wv1Oy7z6Yz3DshWRJFhqM/UCfaWIRTdp0RXyy7KQOVs= cloud.google.com/go/storage v1.10.0/go.mod h1:FLPqc6j+Ki4BU591ie1oL6qBQGu2Bl/tZ9ullr3+Kg0= cloud.google.com/go/storage v1.14.0/go.mod h1:GrKmX003DSIwi9o29oFT7YDnHYwZoctc3fOKtUw0Xmo= +codeberg.org/vlbeaudoin/voki v1.1.2 h1:31xCFeJEGxEpe/o3q+l1np8DUbaWq+TVUf+JVyuUxEc= +codeberg.org/vlbeaudoin/voki v1.1.2/go.mod h1:5XTLx/KiW/OfiupF3o7PAAAU/UhsPdKSrVMmtHbmkPI= dmitri.shuralyov.com/gpu/mtl v0.0.0-20190408044501-666a987793e9/go.mod h1:H6x//7gZCb22OMCxBHrMx7a5I7Hp++hsVxbQ4BYO7hU= git.agecem.com/agecem/bottin/v5 v5.3.0 h1:7Fb0nJaGbWO2q//nTTZcVqLJoVSw0Ov0IoCs7/6ja+o= git.agecem.com/agecem/bottin/v5 v5.3.0/go.mod h1:r4ZZB7P0XL4ZCatD99LHCS9fkpjl0UFCasalYPEW0Hw= From 3052a989b0f8a201814ff8006862032025e943dc Mon Sep 17 00:00:00 2001 From: Victor Lacasse-Beaudoin Date: Mon, 18 Sep 2023 18:44:20 -0400 Subject: [PATCH 41/55] =?UTF-8?q?Migrer=20red=C3=A9finitions=20de=20Respon?= =?UTF-8?q?se=20=C3=A0=20voki?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- apiresponse/apiresponse.go | 21 ++++----------------- go.mod | 2 +- go.sum | 4 ++-- webresponse/webresponse.go | 6 +++--- 4 files changed, 10 insertions(+), 23 deletions(-) diff --git a/apiresponse/apiresponse.go b/apiresponse/apiresponse.go index 2114a9b..6f5afe5 100644 --- a/apiresponse/apiresponse.go +++ b/apiresponse/apiresponse.go @@ -1,24 +1,11 @@ // Package apiresponse provides response types for API routes package apiresponse -// Response defines the basic response types fields -type Response struct { - Error string - Message string - StatusCode int -} - -type Responder interface { - Respond() Responder -} - -func (r Response) Respond() Responder { - return r -} +import "codeberg.org/vlbeaudoin/voki/response" // HealthGET is the response type for `GET /v:version/health/ http/1.1` type HealthGET struct { - Response + response.ResponseWithError Data struct { BottinStatus string } @@ -26,7 +13,7 @@ type HealthGET struct { // ScanGET is the response type for `GET /v:version/scan/ http/1.1` type ScanGET struct { - Response + response.ResponseWithError Data struct { IsScanned bool } @@ -34,5 +21,5 @@ type ScanGET struct { // ScanPOST is the response type for `POST /v:version/scan/ http/1.1` type ScanPOST struct { - Response + response.ResponseWithError } diff --git a/go.mod b/go.mod index 946e796..0d9f055 100644 --- a/go.mod +++ b/go.mod @@ -3,7 +3,7 @@ module git.agecem.com/agecem/bottin-ag go 1.21.0 require ( - codeberg.org/vlbeaudoin/voki v1.1.2 + codeberg.org/vlbeaudoin/voki v1.2.0 git.agecem.com/agecem/bottin/v5 v5.3.0 github.com/jmoiron/sqlx v1.3.5 github.com/labstack/echo/v4 v4.11.1 diff --git a/go.sum b/go.sum index 6c9a2ed..7419f20 100644 --- a/go.sum +++ b/go.sum @@ -35,8 +35,8 @@ cloud.google.com/go/storage v1.6.0/go.mod h1:N7U0C8pVQ/+NIKOBQyamJIeKQKkZ+mxpohl cloud.google.com/go/storage v1.8.0/go.mod h1:Wv1Oy7z6Yz3DshWRJFhqM/UCfaWIRTdp0RXyy7KQOVs= cloud.google.com/go/storage v1.10.0/go.mod h1:FLPqc6j+Ki4BU591ie1oL6qBQGu2Bl/tZ9ullr3+Kg0= cloud.google.com/go/storage v1.14.0/go.mod h1:GrKmX003DSIwi9o29oFT7YDnHYwZoctc3fOKtUw0Xmo= -codeberg.org/vlbeaudoin/voki v1.1.2 h1:31xCFeJEGxEpe/o3q+l1np8DUbaWq+TVUf+JVyuUxEc= -codeberg.org/vlbeaudoin/voki v1.1.2/go.mod h1:5XTLx/KiW/OfiupF3o7PAAAU/UhsPdKSrVMmtHbmkPI= +codeberg.org/vlbeaudoin/voki v1.2.0 h1:MpbZtKvSpkjnduSlNBVikn8OHQFwH9bEBBhUW9LQW34= +codeberg.org/vlbeaudoin/voki v1.2.0/go.mod h1:5XTLx/KiW/OfiupF3o7PAAAU/UhsPdKSrVMmtHbmkPI= dmitri.shuralyov.com/gpu/mtl v0.0.0-20190408044501-666a987793e9/go.mod h1:H6x//7gZCb22OMCxBHrMx7a5I7Hp++hsVxbQ4BYO7hU= git.agecem.com/agecem/bottin/v5 v5.3.0 h1:7Fb0nJaGbWO2q//nTTZcVqLJoVSw0Ov0IoCs7/6ja+o= git.agecem.com/agecem/bottin/v5 v5.3.0/go.mod h1:r4ZZB7P0XL4ZCatD99LHCS9fkpjl0UFCasalYPEW0Hw= diff --git a/webresponse/webresponse.go b/webresponse/webresponse.go index 8d7491a..b2672b2 100644 --- a/webresponse/webresponse.go +++ b/webresponse/webresponse.go @@ -1,11 +1,11 @@ package webresponse -import "git.agecem.com/agecem/bottin-ag/apiresponse" +import "codeberg.org/vlbeaudoin/voki/response" type IndexGET struct { - apiresponse.Response + response.ResponseWithError } type ScanPOST struct { - apiresponse.Response + response.ResponseWithError } From 655e5ca2a5b7c8d257a8e0084d0c8193c5247a9c Mon Sep 17 00:00:00 2001 From: Victor Lacasse-Beaudoin Date: Mon, 18 Sep 2023 21:08:42 -0400 Subject: [PATCH 42/55] Update voki -> v1.3.1 --- go.mod | 2 +- go.sum | 2 ++ 2 files changed, 3 insertions(+), 1 deletion(-) diff --git a/go.mod b/go.mod index 0d9f055..7fa8d2d 100644 --- a/go.mod +++ b/go.mod @@ -3,7 +3,7 @@ module git.agecem.com/agecem/bottin-ag go 1.21.0 require ( - codeberg.org/vlbeaudoin/voki v1.2.0 + codeberg.org/vlbeaudoin/voki v1.3.1 git.agecem.com/agecem/bottin/v5 v5.3.0 github.com/jmoiron/sqlx v1.3.5 github.com/labstack/echo/v4 v4.11.1 diff --git a/go.sum b/go.sum index 7419f20..9b029df 100644 --- a/go.sum +++ b/go.sum @@ -37,6 +37,8 @@ cloud.google.com/go/storage v1.10.0/go.mod h1:FLPqc6j+Ki4BU591ie1oL6qBQGu2Bl/tZ9 cloud.google.com/go/storage v1.14.0/go.mod h1:GrKmX003DSIwi9o29oFT7YDnHYwZoctc3fOKtUw0Xmo= codeberg.org/vlbeaudoin/voki v1.2.0 h1:MpbZtKvSpkjnduSlNBVikn8OHQFwH9bEBBhUW9LQW34= codeberg.org/vlbeaudoin/voki v1.2.0/go.mod h1:5XTLx/KiW/OfiupF3o7PAAAU/UhsPdKSrVMmtHbmkPI= +codeberg.org/vlbeaudoin/voki v1.3.1 h1:TxJj3qmOys0Pbq1dPKnOEXMXKqQLQqrBYd4QqiWWXcw= +codeberg.org/vlbeaudoin/voki v1.3.1/go.mod h1:5XTLx/KiW/OfiupF3o7PAAAU/UhsPdKSrVMmtHbmkPI= dmitri.shuralyov.com/gpu/mtl v0.0.0-20190408044501-666a987793e9/go.mod h1:H6x//7gZCb22OMCxBHrMx7a5I7Hp++hsVxbQ4BYO7hU= git.agecem.com/agecem/bottin/v5 v5.3.0 h1:7Fb0nJaGbWO2q//nTTZcVqLJoVSw0Ov0IoCs7/6ja+o= git.agecem.com/agecem/bottin/v5 v5.3.0/go.mod h1:r4ZZB7P0XL4ZCatD99LHCS9fkpjl0UFCasalYPEW0Hw= From 924ba88014bce934d135b5b6e2d4101214fc2173 Mon Sep 17 00:00:00 2001 From: Victor Lacasse-Beaudoin Date: Mon, 18 Sep 2023 21:11:27 -0400 Subject: [PATCH 43/55] Update go.sum --- go.sum | 2 -- 1 file changed, 2 deletions(-) diff --git a/go.sum b/go.sum index 9b029df..caf67af 100644 --- a/go.sum +++ b/go.sum @@ -35,8 +35,6 @@ cloud.google.com/go/storage v1.6.0/go.mod h1:N7U0C8pVQ/+NIKOBQyamJIeKQKkZ+mxpohl cloud.google.com/go/storage v1.8.0/go.mod h1:Wv1Oy7z6Yz3DshWRJFhqM/UCfaWIRTdp0RXyy7KQOVs= cloud.google.com/go/storage v1.10.0/go.mod h1:FLPqc6j+Ki4BU591ie1oL6qBQGu2Bl/tZ9ullr3+Kg0= cloud.google.com/go/storage v1.14.0/go.mod h1:GrKmX003DSIwi9o29oFT7YDnHYwZoctc3fOKtUw0Xmo= -codeberg.org/vlbeaudoin/voki v1.2.0 h1:MpbZtKvSpkjnduSlNBVikn8OHQFwH9bEBBhUW9LQW34= -codeberg.org/vlbeaudoin/voki v1.2.0/go.mod h1:5XTLx/KiW/OfiupF3o7PAAAU/UhsPdKSrVMmtHbmkPI= codeberg.org/vlbeaudoin/voki v1.3.1 h1:TxJj3qmOys0Pbq1dPKnOEXMXKqQLQqrBYd4QqiWWXcw= codeberg.org/vlbeaudoin/voki v1.3.1/go.mod h1:5XTLx/KiW/OfiupF3o7PAAAU/UhsPdKSrVMmtHbmkPI= dmitri.shuralyov.com/gpu/mtl v0.0.0-20190408044501-666a987793e9/go.mod h1:H6x//7gZCb22OMCxBHrMx7a5I7Hp++hsVxbQ4BYO7hU= From 9ac6bf79401a43d2876d2a4f977d63e56bb561e6 Mon Sep 17 00:00:00 2001 From: Victor Lacasse-Beaudoin Date: Tue, 19 Sep 2023 16:46:44 -0400 Subject: [PATCH 44/55] Ajouter flags web.password et web.user --- config/config.go | 16 +++++++++++++++- 1 file changed, 15 insertions(+), 1 deletion(-) diff --git a/config/config.go b/config/config.go index c1f239a..be43f13 100644 --- a/config/config.go +++ b/config/config.go @@ -46,7 +46,9 @@ type WebConfig struct { Port int Protocol string } - Port int + Password string + Port int + User string } func UnmarshalConfig() (cfg Config, err error) { @@ -184,11 +186,23 @@ func RegisterFlags(cmd *cobra.Command) error { return err } + // web.password ; --web-password + if err := RegisterString(cmd, true, + "web.password", "web-password", "Webserver basic auth password", "bottinag"); 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 { return err } + // web.user ; --web-user + if err := RegisterString(cmd, true, + "web.user", "web-user", "Webserver basic auth username", "bottinag"); err != nil { + return err + } + return nil } From 3b9a51c76712ca0d0cacd57150115cb7d05220c2 Mon Sep 17 00:00:00 2001 From: Victor Lacasse-Beaudoin Date: Tue, 19 Sep 2023 16:47:57 -0400 Subject: [PATCH 45/55] Ajouter API keyauth Defer dbclient.DB.Close() dans apiCmd --- cmd/api.go | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/cmd/api.go b/cmd/api.go index a612846..14ba555 100644 --- a/cmd/api.go +++ b/cmd/api.go @@ -4,6 +4,7 @@ Copyright © 2023 AGECEM & Victor Lacasse-Beaudoin package cmd import ( + "crypto/subtle" "fmt" "log" @@ -30,6 +31,13 @@ var apiCmd = &cobra.Command{ e.Pre(middleware.AddTrailingSlash()) + if cfg.API.Key != "" { + e.Use(middleware.KeyAuth(func(key string, c echo.Context) (bool, error) { + return subtle.ConstantTimeCompare([]byte(key), []byte(cfg.API.Key)) == 1, nil + })) + log.Println("API server is using an API key") + } + v0 := e.Group("/v0") bottinApiClient := bottindata.NewApiClient(cfg.Bottin.API.Key, cfg.Bottin.API.Host, cfg.Bottin.API.Protocol, cfg.Bottin.API.Port) @@ -38,6 +46,7 @@ var apiCmd = &cobra.Command{ if err != nil { log.Fatal(err) } + defer dbClient.DB.Close() handler := apihandler.New(bottinApiClient, dbClient) From a74e36afc1b42a521ed0be1f3ad250cf839385c8 Mon Sep 17 00:00:00 2001 From: Victor Lacasse-Beaudoin Date: Tue, 19 Sep 2023 16:48:29 -0400 Subject: [PATCH 46/55] Ajouter basicauth web --- cmd/web.go | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/cmd/web.go b/cmd/web.go index 0706774..52d584f 100644 --- a/cmd/web.go +++ b/cmd/web.go @@ -4,6 +4,7 @@ Copyright © 2023 AGECEM & Victor Lacasse-Beaudoin package cmd import ( + "crypto/subtle" "fmt" "log" "net/http" @@ -34,6 +35,12 @@ var webCmd = &cobra.Command{ e.Pre(middleware.AddTrailingSlash()) + e.Use(middleware.BasicAuth(func(user, password string, c echo.Context) (bool, error) { + usersMatch := subtle.ConstantTimeCompare([]byte(user), []byte(cfg.Web.User)) == 1 + passwordsMatch := subtle.ConstantTimeCompare([]byte(password), []byte(cfg.Web.Password)) == 1 + return usersMatch && passwordsMatch, nil + })) + client := http.DefaultClient defer client.CloseIdleConnections() From 10901b3f6e4fc41900ffbeb5e28d1d16e81550f2 Mon Sep 17 00:00:00 2001 From: Victor Lacasse-Beaudoin Date: Tue, 19 Sep 2023 16:57:39 -0400 Subject: [PATCH 47/55] =?UTF-8?q?Ajouter=20keyauth=20=C3=A0=20scan=20reque?= =?UTF-8?q?st?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- apiclient/apiclient.go | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/apiclient/apiclient.go b/apiclient/apiclient.go index 95992b8..081d95e 100644 --- a/apiclient/apiclient.go +++ b/apiclient/apiclient.go @@ -15,5 +15,5 @@ type APIClient struct { func (a *APIClient) Scan(membreID string) (response apiresponse.ScanPOST, err error) { //TODO implement api key - return response, a.Voki.Unmarshal(http.MethodPost, fmt.Sprintf("/v0/scan/%s", membreID), nil, false, &response) + return response, a.Voki.Unmarshal(http.MethodPost, fmt.Sprintf("/v0/scan/%s", membreID), nil, true, &response) } From 6c09f1fa65b9451cc2ce270af797d16c35b6bf93 Mon Sep 17 00:00:00 2001 From: Victor Lacasse-Beaudoin Date: Tue, 19 Sep 2023 18:25:12 -0400 Subject: [PATCH 48/55] =?UTF-8?q?Ajouter=20d=C3=A9compte?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- apiclient/apiclient.go | 5 +++- apihandler/apihandler.go | 24 ++++++++++++++++ apiresponse/apiresponse.go | 8 ++++++ dbclient/dbclient.go | 6 ++++ webcontent/html/decompte.html | 4 +++ webcontent/html/index.html | 20 ++++++++++++++ webcontent/html/scan.html | 1 + webhandler/webhandler.go | 52 +++++++++++++++++++++++++++++++++++ webresponse/webresponse.go | 7 +++++ 9 files changed, 126 insertions(+), 1 deletion(-) create mode 100644 webcontent/html/decompte.html diff --git a/apiclient/apiclient.go b/apiclient/apiclient.go index 081d95e..bc05013 100644 --- a/apiclient/apiclient.go +++ b/apiclient/apiclient.go @@ -14,6 +14,9 @@ type APIClient struct { } func (a *APIClient) Scan(membreID string) (response apiresponse.ScanPOST, err error) { - //TODO implement api key return response, a.Voki.Unmarshal(http.MethodPost, fmt.Sprintf("/v0/scan/%s", membreID), nil, true, &response) } + +func (a *APIClient) GetDecompte() (response apiresponse.DecompteGET, err error) { + return response, a.Voki.Unmarshal(http.MethodGet, "/v0/decompte", nil, true, &response) +} diff --git a/apihandler/apihandler.go b/apihandler/apihandler.go index 634cae5..ce231b8 100644 --- a/apihandler/apihandler.go +++ b/apihandler/apihandler.go @@ -17,6 +17,7 @@ func DeclareRoutes(e *echo.Group, h *APIHandler) { e.GET("/health/", h.HealthGET) e.GET("/scan/:membre_id/", h.ScanGET) e.POST("/scan/:membre_id/", h.ScanPOST) + e.GET("/decompte/", h.DecompteGET) } /* @@ -168,3 +169,26 @@ func (a *APIHandler) ScanPOST(c echo.Context) error { return c.JSON(r.StatusCode, r) } + +// DecompteGET is the handler for `GET /v:version/decompte/ http/1.1` +func (a *APIHandler) DecompteGET(c echo.Context) error { + var r apiresponse.DecompteGET + + r.Message = "not ok" + + decompte, err := a.DBClient.GetDecompte() + if err != nil { + r.Error = err.Error() + r.StatusCode = http.StatusInternalServerError + r.Message = "Error during a.DBClient.GetDecompte" + + return c.JSON(r.StatusCode, r) + } + + r.Data.Decompte = decompte + + r.StatusCode = http.StatusOK + r.Message = "ok" + + return c.JSON(r.StatusCode, r) +} diff --git a/apiresponse/apiresponse.go b/apiresponse/apiresponse.go index 6f5afe5..e507dfe 100644 --- a/apiresponse/apiresponse.go +++ b/apiresponse/apiresponse.go @@ -23,3 +23,11 @@ type ScanGET struct { type ScanPOST struct { response.ResponseWithError } + +// DecompteGET is the response type for `GET /v:version/decompte/ http/1.1` +type DecompteGET struct { + response.ResponseWithError + Data struct { + Decompte int + } +} diff --git a/dbclient/dbclient.go b/dbclient/dbclient.go index d6731e3..421585b 100644 --- a/dbclient/dbclient.go +++ b/dbclient/dbclient.go @@ -72,3 +72,9 @@ func (d *DBClient) InsertPresence(presence dbstruct.Presence) (dbstruct.Presence return insertedPresence, nil } + +// GetDecompte returns the row count of the `presences` table and any error encountered +func (d *DBClient) GetDecompte() (decompte int, err error) { + err = d.DB.Get(&decompte, "SELECT COUNT(*) FROM presences;") + return decompte, err +} diff --git a/webcontent/html/decompte.html b/webcontent/html/decompte.html new file mode 100644 index 0000000..bfd86ff --- /dev/null +++ b/webcontent/html/decompte.html @@ -0,0 +1,4 @@ +{{ define "decompte-html" }} + Décompte: {{ .Data.Decompte }} + +{{ end }} diff --git a/webcontent/html/index.html b/webcontent/html/index.html index c5f0e50..4b79e8b 100644 --- a/webcontent/html/index.html +++ b/webcontent/html/index.html @@ -6,6 +6,19 @@ AGECEM | Assemblée Générale +

Présences en Assemblée Générale

@@ -18,8 +31,15 @@ + + + +
+ + {{ end }} diff --git a/webcontent/html/scan.html b/webcontent/html/scan.html index d0b8c91..297cb4e 100644 --- a/webcontent/html/scan.html +++ b/webcontent/html/scan.html @@ -1,3 +1,4 @@ {{ define "scan-html" }}

{{ .Message }}

+ {{ if .Error }}

{{ .Error }}

{{ end }} {{ end }} diff --git a/webhandler/webhandler.go b/webhandler/webhandler.go index 36cff22..10ac173 100644 --- a/webhandler/webhandler.go +++ b/webhandler/webhandler.go @@ -13,6 +13,8 @@ import ( func DeclareRoutes(e *echo.Echo, h *WebHandler) { e.GET("/", h.IndexGET) e.POST("/scan/", h.ScanPOST) + e.GET("/decompte/", h.DecompteGET) + e.GET("/nothing/", h.NothingGET) } type WebHandler struct { @@ -31,6 +33,19 @@ func (w *WebHandler) IndexGET(c echo.Context) error { r.Message = "foo" r.StatusCode = http.StatusOK + /* + decompteResponse, err := w.APIClient.GetDecompte() + if err != nil { + r.Error = err.Error() + r.Message = "Impossible d'obtenir le décompte" + r.StatusCode = http.StatusInternalServerError + + return c.Render(r.StatusCode, "index-html", r) + } + + r.Data.Decompte = decompteResponse.Data.Decompte + */ + return c.Render(r.StatusCode, "index-html", r) } @@ -44,6 +59,19 @@ func (w *WebHandler) ScanPOST(c echo.Context) error { r.StatusCode = http.StatusOK + /* + decompteResponse, err := w.APIClient.GetDecompte() + if err != nil { + r.Error = err.Error() + r.Message = "Impossible d'obtenir le décompte" + r.StatusCode = http.StatusInternalServerError + + return c.Render(r.StatusCode, "index-html", r) + } + + r.Data.Decompte = decompteResponse.Data.Decompte + */ + scanResponse, err := w.APIClient.Scan(membreID) r.Error = scanResponse.Error if err != nil { @@ -54,3 +82,27 @@ func (w *WebHandler) ScanPOST(c echo.Context) error { return c.Render(r.StatusCode, "scan-html", r) } + +func (w *WebHandler) DecompteGET(c echo.Context) error { + var r webresponse.DecompteGET + + decompteResponse, err := w.APIClient.GetDecompte() + if err != nil { + r.Error = err.Error() + r.Message = "Impossible d'obtenir le décompte" + r.StatusCode = http.StatusInternalServerError + + return c.Render(r.StatusCode, "decompte-html", r) + } + + r.Data.Decompte = decompteResponse.Data.Decompte + + r.StatusCode = http.StatusOK + r.Message = "ok" + + return c.Render(r.StatusCode, "decompte-html", r) +} + +func (w *WebHandler) NothingGET(c echo.Context) error { + return c.JSON(http.StatusOK, nil) +} diff --git a/webresponse/webresponse.go b/webresponse/webresponse.go index b2672b2..e95ff93 100644 --- a/webresponse/webresponse.go +++ b/webresponse/webresponse.go @@ -9,3 +9,10 @@ type IndexGET struct { type ScanPOST struct { response.ResponseWithError } + +type DecompteGET struct { + response.ResponseWithError + Data struct { + Decompte int + } +} From 29b4d0da3120dd31f663bd192d9dfc5d302034e9 Mon Sep 17 00:00:00 2001 From: Victor Lacasse-Beaudoin Date: Mon, 2 Oct 2023 14:08:03 -0400 Subject: [PATCH 49/55] =?UTF-8?q?Ajouter=20et=20impl=C3=A9menter=20Presenc?= =?UTF-8?q?esGET?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- apiclient/apiclient.go | 4 ++++ apihandler/apihandler.go | 22 ++++++++++++++++++++++ apiresponse/apiresponse.go | 13 ++++++++++++- dbclient/dbclient.go | 9 +++++++++ 4 files changed, 47 insertions(+), 1 deletion(-) diff --git a/apiclient/apiclient.go b/apiclient/apiclient.go index bc05013..41a7a64 100644 --- a/apiclient/apiclient.go +++ b/apiclient/apiclient.go @@ -20,3 +20,7 @@ func (a *APIClient) Scan(membreID string) (response apiresponse.ScanPOST, err er func (a *APIClient) GetDecompte() (response apiresponse.DecompteGET, err error) { return response, a.Voki.Unmarshal(http.MethodGet, "/v0/decompte", nil, true, &response) } + +func (a *APIClient) GetPresences() (response apiresponse.PresencesGET, err error) { + return response, a.Voki.Unmarshal(http.MethodGet, "/v0/presences", nil, true, &response) +} diff --git a/apihandler/apihandler.go b/apihandler/apihandler.go index ce231b8..8e73ef6 100644 --- a/apihandler/apihandler.go +++ b/apihandler/apihandler.go @@ -18,6 +18,7 @@ func DeclareRoutes(e *echo.Group, h *APIHandler) { e.GET("/scan/:membre_id/", h.ScanGET) e.POST("/scan/:membre_id/", h.ScanPOST) e.GET("/decompte/", h.DecompteGET) + e.GET("/presences/", h.PresencesGET) } /* @@ -192,3 +193,24 @@ func (a *APIHandler) DecompteGET(c echo.Context) error { return c.JSON(r.StatusCode, r) } + +// PresencesGET is the handler for `GET /v:version/presences/ http/1.1` +func (a *APIHandler) PresencesGET(c echo.Context) error { + var r apiresponse.PresencesGET + + presences, err := a.DBClient.GetPresences() + if err != nil { + r.Error = err.Error() + r.StatusCode = http.StatusInternalServerError + r.Message = "Error during a.DBClient.GetPresences" + + return c.JSON(r.StatusCode, r) + } + + r.Data.Presences = presences + + r.StatusCode = http.StatusOK + r.Message = "ok" + + return c.JSON(r.StatusCode, r) +} diff --git a/apiresponse/apiresponse.go b/apiresponse/apiresponse.go index e507dfe..f7a1e5f 100644 --- a/apiresponse/apiresponse.go +++ b/apiresponse/apiresponse.go @@ -1,7 +1,10 @@ // Package apiresponse provides response types for API routes package apiresponse -import "codeberg.org/vlbeaudoin/voki/response" +import ( + "codeberg.org/vlbeaudoin/voki/response" + "git.agecem.com/agecem/bottin-ag/dbstruct" +) // HealthGET is the response type for `GET /v:version/health/ http/1.1` type HealthGET struct { @@ -31,3 +34,11 @@ type DecompteGET struct { Decompte int } } + +// PresencesGET is the response type for `GET /v:version/presences/ http/1.1` +type PresencesGET struct { + response.ResponseWithError + Data struct { + Presences []dbstruct.Presence + } +} diff --git a/dbclient/dbclient.go b/dbclient/dbclient.go index 421585b..7dcf738 100644 --- a/dbclient/dbclient.go +++ b/dbclient/dbclient.go @@ -78,3 +78,12 @@ func (d *DBClient) GetDecompte() (decompte int, err error) { err = d.DB.Get(&decompte, "SELECT COUNT(*) FROM presences;") return decompte, err } + +/* +GetPresences returns all rows in the `presences` table and any error encountered + +Can be used to export the database content at the end of the event. +*/ +func (d *DBClient) GetPresences() (presences []dbstruct.Presence, err error) { + return presences, d.DB.Select(&presences, "SELECT * FROM presences;") +} From 679b594c801120438944700c2c567e64b0370a1c Mon Sep 17 00:00:00 2001 From: Victor Lacasse-Beaudoin Date: Sun, 8 Oct 2023 01:37:06 -0400 Subject: [PATCH 50/55] Migrate config to codeberg.org/vlbeaudoin/serpents v1.0.0 Raw cobra+viper flags that were not yet migrated to Register* functions now migrated to serpents as well --- cmd/root.go | 2 +- config/config.go | 114 +++++++++++++++++------------------------------ go.mod | 5 ++- go.sum | 2 + 4 files changed, 47 insertions(+), 76 deletions(-) diff --git a/cmd/root.go b/cmd/root.go index 478df63..e56582d 100644 --- a/cmd/root.go +++ b/cmd/root.go @@ -31,7 +31,7 @@ func init() { rootCmd.PersistentFlags().StringVar(&cfgFile, "config", "", "config file (default is $HOME/.bottin-ag.yaml)") - if err := config.RegisterFlags(rootCmd); err != nil { + if err := config.RegisterFlags(rootCmd.PersistentFlags()); err != nil { log.Fatal(err) } } diff --git a/config/config.go b/config/config.go index be43f13..780731c 100644 --- a/config/config.go +++ b/config/config.go @@ -5,7 +5,8 @@ config options and flags package config import ( - "github.com/spf13/cobra" + "codeberg.org/vlbeaudoin/serpents" + "github.com/spf13/pflag" "github.com/spf13/viper" ) @@ -55,152 +56,119 @@ func UnmarshalConfig() (cfg Config, err error) { return cfg, viper.Unmarshal(&cfg) } -// RegisterBool registers a new cobra bool flag and associated viper config option -func RegisterBool(cmd *cobra.Command, isPersistent bool, viperName, cobraName, cobraDescription string, cobraDefault bool) error { - if isPersistent { - cmd.PersistentFlags().Bool(cobraName, cobraDefault, cobraDescription) - return viper.BindPFlag(viperName, cmd.PersistentFlags().Lookup(cobraName)) - } else { - cmd.Flags().Bool(cobraName, cobraDefault, cobraDescription) - return viper.BindPFlag(viperName, cmd.Flags().Lookup(cobraName)) - } -} - -// RegisterInt registers a new cobra int flag and associated viper config option -func RegisterInt(cmd *cobra.Command, isPersistent bool, viperName, cobraName, cobraDescription string, cobraDefault int) error { - if isPersistent { - cmd.PersistentFlags().Int(cobraName, cobraDefault, cobraDescription) - return viper.BindPFlag(viperName, cmd.PersistentFlags().Lookup(cobraName)) - } else { - cmd.Flags().Int(cobraName, cobraDefault, cobraDescription) - return viper.BindPFlag(viperName, cmd.Flags().Lookup(cobraName)) - } -} - -// RegisterString registers a new cobra string flag and associated viper config option -func RegisterString(cmd *cobra.Command, isPersistent bool, viperName, cobraName, cobraDescription string, cobraDefault string) error { - if isPersistent { - cmd.PersistentFlags().String(cobraName, cobraDefault, cobraDescription) - return viper.BindPFlag(viperName, cmd.PersistentFlags().Lookup(cobraName)) - } else { - cmd.Flags().String(cobraName, cobraDefault, cobraDescription) - return viper.BindPFlag(viperName, cmd.Flags().Lookup(cobraName)) - } -} - // RegisterFlags adds persistent flags necessary to the application to the specified *cobra.Command -func RegisterFlags(cmd *cobra.Command) error { +func RegisterFlags(flagSet *pflag.FlagSet) error { // api.port ; --api-port - cmd.PersistentFlags().Int("api-port", 3182, "API server port") - if err := viper.BindPFlag("api.port", cmd.PersistentFlags().Lookup("api-port")); err != nil { + if err := serpents.Int(flagSet, + "api.port", "api-port", 3182, "API server port"); err != nil { return err } // api.key ; --api-key - if err := RegisterString(cmd, true, - "api.key", "api-key", "API server key", "bottinag"); err != nil { + if err := serpents.String(flagSet, + "api.key", "api-key", "bottinag", "API server key"); err != nil { return err } // bottin.api.host - if err := RegisterString(cmd, true, - "bottin.api.host", "bottin-api-host", "Bottin API server host", "localhost"); err != nil { + if err := serpents.String(flagSet, + "bottin.api.host", "bottin-api-host", "localhost", "Bottin API server host"); err != nil { return err } // bottin.api.key - if err := RegisterString(cmd, true, - "bottin.api.key", "bottin-api-key", "Bottin API server key", "bottin"); err != nil { + if err := serpents.String(flagSet, + "bottin.api.key", "bottin-api-key", "bottin", "Bottin API server key"); err != nil { return err } // bottin.api.port - if err := RegisterInt(cmd, true, - "bottin.api.port", "bottin-api-port", "Bottin API server port", 1312); err != nil { + if err := serpents.Int(flagSet, + "bottin.api.port", "bottin-api-port", 1312, "Bottin API server port"); 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 { + if err := serpents.String(flagSet, + "bottin.api.protocol", "bottin-api-protocol", "http", "Bottin API server protocol"); err != nil { return err } // db.database - if err := RegisterString(cmd, true, - "db.database", "db-database", "PostgreSQL database", "bottinag"); err != nil { + if err := serpents.String(flagSet, + "db.database", "db-database", "bottinag", "PostgreSQL database"); err != nil { return err } // db.host - if err := RegisterString(cmd, true, - "db.host", "db-host", "PostgreSQL host", "db"); err != nil { + if err := serpents.String(flagSet, + "db.host", "db-host", "db", "PostgreSQL host"); err != nil { return err } // db.password - if err := RegisterString(cmd, true, - "db.password", "db-password", "PostgreSQL password", "bottinag"); err != nil { + if err := serpents.String(flagSet, + "db.password", "db-password", "bottinag", "PostgreSQL password"); err != nil { return err } // db.port - if err := RegisterInt(cmd, true, - "db.port", "db-port", "PostgreSQL port", 5432); err != nil { + if err := serpents.Int(flagSet, + "db.port", "db-port", 5432, "PostgreSQL port"); err != nil { return err } // db.user - if err := RegisterString(cmd, true, - "db.user", "db-user", "PostgreSQL user", "bottinag"); err != nil { + if err := serpents.String(flagSet, + "db.user", "db-user", "bottinag", "PostgreSQL user"); err != nil { return err } // db.use_ssl - if err := RegisterBool(cmd, true, - "db.use_ssl", "db-use-ssl", "PostgreSQL use_ssl", false); err != nil { + if err := serpents.Bool(flagSet, + "db.use_ssl", "db-use-ssl", false, "PostgreSQL use_ssl"); err != nil { return err } // web.api.host - if err := RegisterString(cmd, true, - "web.api.host", "web-api-host", "Webserver API client host", "localhost"); err != nil { + if err := serpents.String(flagSet, + "web.api.host", "web-api-host", "localhost", "Webserver API client host"); err != nil { return err } // web.api.key - if err := RegisterString(cmd, true, - "web.api.key", "web-api-key", "Webserver API client key", "bottinag"); err != nil { + if err := serpents.String(flagSet, + "web.api.key", "web-api-key", "bottinag", "Webserver API client key"); err != nil { return err } // web.api.port - if err := RegisterInt(cmd, true, - "web.api.port", "web-api-port", "Webserver API client port", 3182); err != nil { + if err := serpents.Int(flagSet, + "web.api.port", "web-api-port", 3182, "Webserver API client port"); err != nil { return err } // web.api.protocol - if err := RegisterString(cmd, true, - "web.api.protocol", "web-api-protocol", "Webserver API client protocol", "http"); err != nil { + if err := serpents.String(flagSet, + "web.api.protocol", "web-api-protocol", "http", "Webserver API client protocol"); err != nil { return err } // web.password ; --web-password - if err := RegisterString(cmd, true, - "web.password", "web-password", "Webserver basic auth password", "bottinag"); err != nil { + if err := serpents.String(flagSet, + "web.password", "web-password", "bottinag", "Webserver basic auth password"); 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 { + if err := serpents.Int(flagSet, + "web.port", "web-port", 3183, "Webserver port"); err != nil { return err } // web.user ; --web-user - if err := RegisterString(cmd, true, - "web.user", "web-user", "Webserver basic auth username", "bottinag"); err != nil { + if err := serpents.String(flagSet, + "web.user", "web-user", "bottinag", "Webserver basic auth username"); err != nil { return err } diff --git a/go.mod b/go.mod index 7fa8d2d..37d0c54 100644 --- a/go.mod +++ b/go.mod @@ -1,13 +1,15 @@ module git.agecem.com/agecem/bottin-ag -go 1.21.0 +go 1.21.1 require ( + codeberg.org/vlbeaudoin/serpents v1.0.0 codeberg.org/vlbeaudoin/voki v1.3.1 git.agecem.com/agecem/bottin/v5 v5.3.0 github.com/jmoiron/sqlx v1.3.5 github.com/labstack/echo/v4 v4.11.1 github.com/spf13/cobra v1.7.0 + github.com/spf13/pflag v1.0.5 github.com/spf13/viper v1.16.0 ) @@ -27,7 +29,6 @@ require ( github.com/spf13/afero v1.9.5 // indirect github.com/spf13/cast v1.5.1 // indirect github.com/spf13/jwalterweatherman v1.1.0 // indirect - github.com/spf13/pflag v1.0.5 // indirect github.com/subosito/gotenv v1.4.2 // indirect github.com/valyala/bytebufferpool v1.0.0 // indirect github.com/valyala/fasttemplate v1.2.2 // indirect diff --git a/go.sum b/go.sum index caf67af..1e51f46 100644 --- a/go.sum +++ b/go.sum @@ -35,6 +35,8 @@ cloud.google.com/go/storage v1.6.0/go.mod h1:N7U0C8pVQ/+NIKOBQyamJIeKQKkZ+mxpohl cloud.google.com/go/storage v1.8.0/go.mod h1:Wv1Oy7z6Yz3DshWRJFhqM/UCfaWIRTdp0RXyy7KQOVs= cloud.google.com/go/storage v1.10.0/go.mod h1:FLPqc6j+Ki4BU591ie1oL6qBQGu2Bl/tZ9ullr3+Kg0= cloud.google.com/go/storage v1.14.0/go.mod h1:GrKmX003DSIwi9o29oFT7YDnHYwZoctc3fOKtUw0Xmo= +codeberg.org/vlbeaudoin/serpents v1.0.0 h1:3mN5QdVojmd3U0ISh/jgSslNOd7By0H3u9enRwgimkE= +codeberg.org/vlbeaudoin/serpents v1.0.0/go.mod h1:3bE/R0ToABwcUJtS1VcGEBa86K5FYhrZGAbFl2qL8kQ= codeberg.org/vlbeaudoin/voki v1.3.1 h1:TxJj3qmOys0Pbq1dPKnOEXMXKqQLQqrBYd4QqiWWXcw= codeberg.org/vlbeaudoin/voki v1.3.1/go.mod h1:5XTLx/KiW/OfiupF3o7PAAAU/UhsPdKSrVMmtHbmkPI= dmitri.shuralyov.com/gpu/mtl v0.0.0-20190408044501-666a987793e9/go.mod h1:H6x//7gZCb22OMCxBHrMx7a5I7Hp++hsVxbQ4BYO7hU= From 990fe99e2c70fc2ba339c225083b52b1b393a720 Mon Sep 17 00:00:00 2001 From: Victor Lacasse-Beaudoin Date: Wed, 14 Feb 2024 14:49:58 -0500 Subject: [PATCH 51/55] feat: Ajouter et documenter configuration par env --- README.md | 4 ++++ cmd/root.go | 3 +++ docker-compose.yaml | 10 ++++++++++ 3 files changed, 17 insertions(+) diff --git a/README.md b/README.md index b4bcb34..2cc6c87 100644 --- a/README.md +++ b/README.md @@ -14,6 +14,10 @@ Remplir .env BOTTINAG_POSTGRES_DATABASE=bottinag BOTTINAG_POSTGRES_PASSWORD=bottinag BOTTINAG_POSTGRES_USER=bottinag +BOTTINAG_API_KEY=bottinag +BOTTINAG_BOTTIN_API_KEY=bottin +BOTTINAG_WEB_PASSWORD=bottinag +BOTTINAG_WEB_USER=bottinag ``` Le reste s'effectue par le `go` toolchain ou `docker-compose`. diff --git a/cmd/root.go b/cmd/root.go index e56582d..3bf81b3 100644 --- a/cmd/root.go +++ b/cmd/root.go @@ -5,6 +5,7 @@ import ( "fmt" "log" "os" + "strings" "git.agecem.com/agecem/bottin-ag/config" "github.com/spf13/cobra" @@ -52,6 +53,8 @@ func initConfig() { viper.SetConfigName(".bottin-ag") } + viper.SetEnvPrefix("BOTTINAG") + viper.SetEnvKeyReplacer(strings.NewReplacer(".", "_")) viper.AutomaticEnv() // read in environment variables that match // If a config file is found, read it in. diff --git a/docker-compose.yaml b/docker-compose.yaml index 0d13037..d6b0f2f 100644 --- a/docker-compose.yaml +++ b/docker-compose.yaml @@ -15,6 +15,12 @@ services: - db build: . image: 'git.agecem.com/agecem/bottin-ag:latest' + environment: + BOTTINAG_API_KEY: "${BOTTINAG_API_KEY}" + BOTTINAG_BOTTIN_API_KEY: "${BOTTINAG_BOTTIN_API_KEY}" + BOTTINAG_DB_DATABASE: "${BOTTINAG_POSTGRES_DATABASE}" + BOTTINAG_DB_PASSWORD: "${BOTTINAG_POSTGRES_PASSWORD}" + BOTTINAG_DB_USER: "${BOTTINAG_POSTGRES_USER}" ports: - '3182:3182' volumes: @@ -27,6 +33,10 @@ services: - api build: . image: 'git.agecem.com/agecem/bottin-ag:latest' + environment: + BOTTINAG_WEB_API_KEY: "${BOTTINAG_API_KEY}" + BOTTINAG_WEB_PASSWORD: "${BOTTINAG_WEB_PASSWORD}" + BOTTINAG_WEB_USER: "${BOTTINAG_WEB_USER}" ports: - '3183:3183' volumes: From 83cd2cd4afae7e751b6a6d3ab0b2eeb17e1d1944 Mon Sep 17 00:00:00 2001 From: Victor Lacasse-Beaudoin Date: Wed, 14 Feb 2024 16:48:20 -0500 Subject: [PATCH 52/55] chores: bump dependencies Bump bottin v5 -> v6 `go get -u` --- apihandler/apihandler.go | 4 +- cmd/api.go | 2 +- go.mod | 42 +-- go.sum | 540 +++++---------------------------------- 4 files changed, 83 insertions(+), 505 deletions(-) diff --git a/apihandler/apihandler.go b/apihandler/apihandler.go index 8e73ef6..fe10e77 100644 --- a/apihandler/apihandler.go +++ b/apihandler/apihandler.go @@ -8,7 +8,7 @@ import ( "git.agecem.com/agecem/bottin-ag/apiresponse" "git.agecem.com/agecem/bottin-ag/dbclient" "git.agecem.com/agecem/bottin-ag/dbstruct" - bottindata "git.agecem.com/agecem/bottin/v5/data" + bottindata "git.agecem.com/agecem/bottin/v6/data" "github.com/labstack/echo/v4" ) @@ -56,7 +56,7 @@ func (a *APIHandler) HealthGET(c echo.Context) error { } switch r.Data.BottinStatus { - case "Bottin API v5 is ready": + case "Bottin API v6 is ready": r.Message = "ok" r.StatusCode = http.StatusOK default: diff --git a/cmd/api.go b/cmd/api.go index 14ba555..fa70ab6 100644 --- a/cmd/api.go +++ b/cmd/api.go @@ -11,7 +11,7 @@ import ( "git.agecem.com/agecem/bottin-ag/apihandler" "git.agecem.com/agecem/bottin-ag/config" "git.agecem.com/agecem/bottin-ag/dbclient" - bottindata "git.agecem.com/agecem/bottin/v5/data" + bottindata "git.agecem.com/agecem/bottin/v6/data" "github.com/labstack/echo/v4" "github.com/labstack/echo/v4/middleware" "github.com/spf13/cobra" diff --git a/go.mod b/go.mod index 37d0c54..3807dd3 100644 --- a/go.mod +++ b/go.mod @@ -3,40 +3,44 @@ module git.agecem.com/agecem/bottin-ag go 1.21.1 require ( - codeberg.org/vlbeaudoin/serpents v1.0.0 - codeberg.org/vlbeaudoin/voki v1.3.1 - git.agecem.com/agecem/bottin/v5 v5.3.0 + codeberg.org/vlbeaudoin/serpents v1.1.0 + codeberg.org/vlbeaudoin/voki v1.7.1 + git.agecem.com/agecem/bottin/v6 v6.2.2 github.com/jmoiron/sqlx v1.3.5 - github.com/labstack/echo/v4 v4.11.1 - github.com/spf13/cobra v1.7.0 + github.com/labstack/echo/v4 v4.11.4 + github.com/spf13/cobra v1.8.0 github.com/spf13/pflag v1.0.5 - github.com/spf13/viper v1.16.0 + github.com/spf13/viper v1.18.2 ) require ( - github.com/fsnotify/fsnotify v1.6.0 // indirect + github.com/fsnotify/fsnotify v1.7.0 // indirect github.com/golang-jwt/jwt v3.2.2+incompatible // indirect github.com/hashicorp/hcl v1.0.0 // indirect github.com/inconshreveable/mousetrap v1.1.0 // indirect github.com/jackc/pgx v3.6.2+incompatible // indirect - github.com/labstack/gommon v0.4.0 // indirect + github.com/labstack/gommon v0.4.2 // indirect github.com/magiconair/properties v1.8.7 // indirect github.com/mattn/go-colorable v0.1.13 // indirect - github.com/mattn/go-isatty v0.0.19 // indirect + github.com/mattn/go-isatty v0.0.20 // indirect github.com/mitchellh/mapstructure v1.5.0 // indirect - github.com/pelletier/go-toml/v2 v2.0.8 // indirect + github.com/pelletier/go-toml/v2 v2.1.1 // indirect github.com/pkg/errors v0.9.1 // indirect - github.com/spf13/afero v1.9.5 // indirect - github.com/spf13/cast v1.5.1 // indirect - github.com/spf13/jwalterweatherman v1.1.0 // indirect - github.com/subosito/gotenv v1.4.2 // indirect + github.com/sagikazarmark/locafero v0.4.0 // indirect + github.com/sagikazarmark/slog-shim v0.1.0 // indirect + github.com/sourcegraph/conc v0.3.0 // indirect + github.com/spf13/afero v1.11.0 // indirect + github.com/spf13/cast v1.6.0 // indirect + github.com/subosito/gotenv v1.6.0 // indirect github.com/valyala/bytebufferpool v1.0.0 // indirect github.com/valyala/fasttemplate v1.2.2 // indirect - golang.org/x/crypto v0.11.0 // indirect - golang.org/x/net v0.12.0 // indirect - golang.org/x/sys v0.10.0 // indirect - golang.org/x/text v0.11.0 // indirect - golang.org/x/time v0.3.0 // indirect + go.uber.org/multierr v1.11.0 // indirect + golang.org/x/crypto v0.19.0 // indirect + golang.org/x/exp v0.0.0-20240213143201-ec583247a57a // indirect + golang.org/x/net v0.21.0 // indirect + golang.org/x/sys v0.17.0 // indirect + golang.org/x/text v0.14.0 // indirect + golang.org/x/time v0.5.0 // indirect gopkg.in/ini.v1 v1.67.0 // indirect gopkg.in/yaml.v3 v3.0.1 // indirect ) diff --git a/go.sum b/go.sum index 1e51f46..fe245c0 100644 --- a/go.sum +++ b/go.sum @@ -1,144 +1,30 @@ -cloud.google.com/go v0.26.0/go.mod h1:aQUYkXzVsufM+DwF1aE+0xfcU+56JwCaLick0ClmMTw= -cloud.google.com/go v0.34.0/go.mod h1:aQUYkXzVsufM+DwF1aE+0xfcU+56JwCaLick0ClmMTw= -cloud.google.com/go v0.38.0/go.mod h1:990N+gfupTy94rShfmMCWGDn0LpTmnzTp2qbd1dvSRU= -cloud.google.com/go v0.44.1/go.mod h1:iSa0KzasP4Uvy3f1mN/7PiObzGgflwredwwASm/v6AU= -cloud.google.com/go v0.44.2/go.mod h1:60680Gw3Yr4ikxnPRS/oxxkBccT6SA1yMk63TGekxKY= -cloud.google.com/go v0.44.3/go.mod h1:60680Gw3Yr4ikxnPRS/oxxkBccT6SA1yMk63TGekxKY= -cloud.google.com/go v0.45.1/go.mod h1:RpBamKRgapWJb87xiFSdk4g1CME7QZg3uwTez+TSTjc= -cloud.google.com/go v0.46.3/go.mod h1:a6bKKbmY7er1mI7TEI4lsAkts/mkhTSZK8w33B4RAg0= -cloud.google.com/go v0.50.0/go.mod h1:r9sluTvynVuxRIOHXQEHMFffphuXHOMZMycpNR5e6To= -cloud.google.com/go v0.52.0/go.mod h1:pXajvRH/6o3+F9jDHZWQ5PbGhn+o8w9qiu/CffaVdO4= -cloud.google.com/go v0.53.0/go.mod h1:fp/UouUEsRkN6ryDKNW/Upv/JBKnv6WDthjR6+vze6M= -cloud.google.com/go v0.54.0/go.mod h1:1rq2OEkV3YMf6n/9ZvGWI3GWw0VoqH/1x2nd8Is/bPc= -cloud.google.com/go v0.56.0/go.mod h1:jr7tqZxxKOVYizybht9+26Z/gUq7tiRzu+ACVAMbKVk= -cloud.google.com/go v0.57.0/go.mod h1:oXiQ6Rzq3RAkkY7N6t3TcE6jE+CIBBbA36lwQ1JyzZs= -cloud.google.com/go v0.62.0/go.mod h1:jmCYTdRCQuc1PHIIJ/maLInMho30T/Y0M4hTdTShOYc= -cloud.google.com/go v0.65.0/go.mod h1:O5N8zS7uWy9vkA9vayVHs65eM1ubvY4h553ofrNHObY= -cloud.google.com/go v0.72.0/go.mod h1:M+5Vjvlc2wnp6tjzE102Dw08nGShTscUx2nZMufOKPI= -cloud.google.com/go v0.74.0/go.mod h1:VV1xSbzvo+9QJOxLDaJfTjx5e+MePCpCWwvftOeQmWk= -cloud.google.com/go v0.75.0/go.mod h1:VGuuCn7PG0dwsd5XPVm2Mm3wlh3EL55/79EKB6hlPTY= -cloud.google.com/go/bigquery v1.0.1/go.mod h1:i/xbL2UlR5RvWAURpBYZTtm/cXjCha9lbfbpx4poX+o= -cloud.google.com/go/bigquery v1.3.0/go.mod h1:PjpwJnslEMmckchkHFfq+HTD2DmtT67aNFKH1/VBDHE= -cloud.google.com/go/bigquery v1.4.0/go.mod h1:S8dzgnTigyfTmLBfrtrhyYhwRxG72rYxvftPBK2Dvzc= -cloud.google.com/go/bigquery v1.5.0/go.mod h1:snEHRnqQbz117VIFhE8bmtwIDY80NLUZUMb4Nv6dBIg= -cloud.google.com/go/bigquery v1.7.0/go.mod h1://okPTzCYNXSlb24MZs83e2Do+h+VXtc4gLoIoXIAPc= -cloud.google.com/go/bigquery v1.8.0/go.mod h1:J5hqkt3O0uAFnINi6JXValWIb1v0goeZM77hZzJN/fQ= -cloud.google.com/go/datastore v1.0.0/go.mod h1:LXYbyblFSglQ5pkeyhO+Qmw7ukd3C+pD7TKLgZqpHYE= -cloud.google.com/go/datastore v1.1.0/go.mod h1:umbIZjpQpHh4hmRpGhH4tLFup+FVzqBi1b3c64qFpCk= -cloud.google.com/go/pubsub v1.0.1/go.mod h1:R0Gpsv3s54REJCy4fxDixWD93lHJMoZTyQ2kNxGRt3I= -cloud.google.com/go/pubsub v1.1.0/go.mod h1:EwwdRX2sKPjnvnqCa270oGRyludottCI76h+R3AArQw= -cloud.google.com/go/pubsub v1.2.0/go.mod h1:jhfEVHT8odbXTkndysNHCcx0awwzvfOlguIAii9o8iA= -cloud.google.com/go/pubsub v1.3.1/go.mod h1:i+ucay31+CNRpDW4Lu78I4xXG+O1r/MAHgjpRVR+TSU= -cloud.google.com/go/storage v1.0.0/go.mod h1:IhtSnM/ZTZV8YYJWCY8RULGVqBDmpoyjwiyrjsg+URw= -cloud.google.com/go/storage v1.5.0/go.mod h1:tpKbwo567HUNpVclU5sGELwQWBDZ8gh0ZeosJ0Rtdos= -cloud.google.com/go/storage v1.6.0/go.mod h1:N7U0C8pVQ/+NIKOBQyamJIeKQKkZ+mxpohlUTyfDhBk= -cloud.google.com/go/storage v1.8.0/go.mod h1:Wv1Oy7z6Yz3DshWRJFhqM/UCfaWIRTdp0RXyy7KQOVs= -cloud.google.com/go/storage v1.10.0/go.mod h1:FLPqc6j+Ki4BU591ie1oL6qBQGu2Bl/tZ9ullr3+Kg0= -cloud.google.com/go/storage v1.14.0/go.mod h1:GrKmX003DSIwi9o29oFT7YDnHYwZoctc3fOKtUw0Xmo= -codeberg.org/vlbeaudoin/serpents v1.0.0 h1:3mN5QdVojmd3U0ISh/jgSslNOd7By0H3u9enRwgimkE= -codeberg.org/vlbeaudoin/serpents v1.0.0/go.mod h1:3bE/R0ToABwcUJtS1VcGEBa86K5FYhrZGAbFl2qL8kQ= -codeberg.org/vlbeaudoin/voki v1.3.1 h1:TxJj3qmOys0Pbq1dPKnOEXMXKqQLQqrBYd4QqiWWXcw= -codeberg.org/vlbeaudoin/voki v1.3.1/go.mod h1:5XTLx/KiW/OfiupF3o7PAAAU/UhsPdKSrVMmtHbmkPI= -dmitri.shuralyov.com/gpu/mtl v0.0.0-20190408044501-666a987793e9/go.mod h1:H6x//7gZCb22OMCxBHrMx7a5I7Hp++hsVxbQ4BYO7hU= -git.agecem.com/agecem/bottin/v5 v5.3.0 h1:7Fb0nJaGbWO2q//nTTZcVqLJoVSw0Ov0IoCs7/6ja+o= -git.agecem.com/agecem/bottin/v5 v5.3.0/go.mod h1:r4ZZB7P0XL4ZCatD99LHCS9fkpjl0UFCasalYPEW0Hw= -github.com/BurntSushi/toml v0.3.1/go.mod h1:xHWCNGjB5oqiDr8zfno3MHue2Ht5sIBksp03qcyfWMU= -github.com/BurntSushi/xgb v0.0.0-20160522181843-27f122750802/go.mod h1:IVnqGOEym/WlBOVXweHU+Q+/VP0lqqI8lqeDx9IjBqo= -github.com/census-instrumentation/opencensus-proto v0.2.1/go.mod h1:f6KPmirojxKA12rnyqOA5BBL4O983OfeGPqjHWSTneU= -github.com/chzyer/logex v1.1.10/go.mod h1:+Ywpsq7O8HXn0nuIou7OrIPyXbp3wmkHB+jjWRnGsAI= -github.com/chzyer/readline v0.0.0-20180603132655-2972be24d48e/go.mod h1:nSuG5e5PlCu98SY8svDHJxuZscDgtXS6KTTbou5AhLI= -github.com/chzyer/test v0.0.0-20180213035817-a1ea475d72b1/go.mod h1:Q3SI9o4m/ZMnBNeIyt5eFwwo7qiLfzFZmjNmxjkiQlU= -github.com/client9/misspell v0.3.4/go.mod h1:qj6jICC3Q7zFZvVWo7KLAzC3yx5G7kyvSDkc90ppPyw= -github.com/cncf/udpa/go v0.0.0-20191209042840-269d4d468f6f/go.mod h1:M8M6+tZqaGXZJjfX53e64911xZQV5JYwmTeXPW+k8Sc= -github.com/cncf/udpa/go v0.0.0-20200629203442-efcf912fb354/go.mod h1:WmhPx2Nbnhtbo57+VJT5O0JRkEi1Wbu0z5j0R8u5Hbk= -github.com/cncf/udpa/go v0.0.0-20201120205902-5459f2c99403/go.mod h1:WmhPx2Nbnhtbo57+VJT5O0JRkEi1Wbu0z5j0R8u5Hbk= +codeberg.org/vlbeaudoin/serpents v1.1.0 h1:U9f2+2D1yUVHx90yePi2ZOLRLG/Wkoob4JXDIVyoBwA= +codeberg.org/vlbeaudoin/serpents v1.1.0/go.mod h1:3bE/R0ToABwcUJtS1VcGEBa86K5FYhrZGAbFl2qL8kQ= +codeberg.org/vlbeaudoin/voki v1.7.1 h1:Eywgk2A8NQmg4vucJjtheUpB0S2RYlDS8A7VwP+wFHU= +codeberg.org/vlbeaudoin/voki v1.7.1/go.mod h1:5XTLx/KiW/OfiupF3o7PAAAU/UhsPdKSrVMmtHbmkPI= +git.agecem.com/agecem/bottin/v6 v6.2.2 h1:dziH033O38jXL3dpwwGR3bnrt3LP1/E8vHhpbibzMIc= +git.agecem.com/agecem/bottin/v6 v6.2.2/go.mod h1:v1lU+D51G8aGs9S2vixcZViHYiZXnETOuH6lcg2jBtY= github.com/cockroachdb/apd v1.1.0 h1:3LFP3629v+1aKXU5Q37mxmRxX/pIu1nijXydLShEq5I= github.com/cockroachdb/apd v1.1.0/go.mod h1:8Sl8LxpKi29FqWXR16WEFZRNSz3SoPzUzeMeY4+DwBQ= -github.com/cpuguy83/go-md2man/v2 v2.0.2/go.mod h1:tgQtvFlXSQOSOSIRvRPT7W67SCa46tRHOmNcaadrF8o= +github.com/cpuguy83/go-md2man/v2 v2.0.3/go.mod h1:tgQtvFlXSQOSOSIRvRPT7W67SCa46tRHOmNcaadrF8o= github.com/davecgh/go-spew v1.1.0/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38= -github.com/davecgh/go-spew v1.1.1 h1:vj9j/u1bqnvCEfJOwUhtlOARqs3+rkHYY13jYWTU97c= github.com/davecgh/go-spew v1.1.1/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38= -github.com/envoyproxy/go-control-plane v0.9.0/go.mod h1:YTl/9mNaCwkRvm6d1a2C3ymFceY/DCBVvsKhRF0iEA4= -github.com/envoyproxy/go-control-plane v0.9.1-0.20191026205805-5f8ba28d4473/go.mod h1:YTl/9mNaCwkRvm6d1a2C3ymFceY/DCBVvsKhRF0iEA4= -github.com/envoyproxy/go-control-plane v0.9.4/go.mod h1:6rpuAdCZL397s3pYoYcLgu1mIlRU8Am5FuJP05cCM98= -github.com/envoyproxy/go-control-plane v0.9.7/go.mod h1:cwu0lG7PUMfa9snN8LXBig5ynNVH9qI8YYLbd1fK2po= -github.com/envoyproxy/go-control-plane v0.9.9-0.20201210154907-fd9021fe5dad/go.mod h1:cXg6YxExXjJnVBQHBLXeUAgxn2UodCpnH306RInaBQk= -github.com/envoyproxy/protoc-gen-validate v0.1.0/go.mod h1:iSmxcyjqTsJpI2R4NaDN7+kN2VEUnK/pcBlmesArF7c= -github.com/frankban/quicktest v1.14.4 h1:g2rn0vABPOOXmZUj+vbmUp0lPoXEMuhTpIluN0XL9UY= -github.com/frankban/quicktest v1.14.4/go.mod h1:4ptaffx2x8+WTWXmUCuVU6aPUX1/Mz7zb5vbUoiM6w0= -github.com/fsnotify/fsnotify v1.6.0 h1:n+5WquG0fcWoWp6xPWfHdbskMCQaFnG6PfBrh1Ky4HY= -github.com/fsnotify/fsnotify v1.6.0/go.mod h1:sl3t1tCWJFWoRz9R8WJCbQihKKwmorjAbSClcnxKAGw= -github.com/go-gl/glfw v0.0.0-20190409004039-e6da0acd62b1/go.mod h1:vR7hzQXu2zJy9AVAgeJqvqgH9Q5CA+iKCZ2gyEVpxRU= -github.com/go-gl/glfw/v3.3/glfw v0.0.0-20191125211704-12ad95a8df72/go.mod h1:tQ2UAYgL5IevRw8kRxooKSPJfGvJ9fJQFa0TUsXzTg8= -github.com/go-gl/glfw/v3.3/glfw v0.0.0-20200222043503-6f7a984d4dc4/go.mod h1:tQ2UAYgL5IevRw8kRxooKSPJfGvJ9fJQFa0TUsXzTg8= +github.com/davecgh/go-spew v1.1.2-0.20180830191138-d8f796af33cc h1:U9qPSI2PIWSS1VwoXQT9A3Wy9MM3WgvqSxFWenqJduM= +github.com/davecgh/go-spew v1.1.2-0.20180830191138-d8f796af33cc/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38= +github.com/frankban/quicktest v1.14.6 h1:7Xjx+VpznH+oBnejlPUj8oUpdxnVs4f8XU8WnHkI4W8= +github.com/frankban/quicktest v1.14.6/go.mod h1:4ptaffx2x8+WTWXmUCuVU6aPUX1/Mz7zb5vbUoiM6w0= +github.com/fsnotify/fsnotify v1.7.0 h1:8JEhPFa5W2WU7YfeZzPNqzMP6Lwt7L2715Ggo0nosvA= +github.com/fsnotify/fsnotify v1.7.0/go.mod h1:40Bi/Hjc2AVfZrqy+aj+yEI+/bRxZnMJyTJwOpGvigM= github.com/go-sql-driver/mysql v1.6.0 h1:BCTh4TKNUYmOmMUcQ3IipzF5prigylS7XXjEkfCHuOE= github.com/go-sql-driver/mysql v1.6.0/go.mod h1:DCzpHaOWr8IXmIStZouvnhqoel9Qv2LBy8hT2VhHyBg= github.com/gofrs/uuid v4.4.0+incompatible h1:3qXRTX8/NbyulANqlc0lchS1gqAVxRgsuW1YrTJupqA= github.com/gofrs/uuid v4.4.0+incompatible/go.mod h1:b2aQJv3Z4Fp6yNu3cdSllBxTCLRxnplIgP/c0N/04lM= github.com/golang-jwt/jwt v3.2.2+incompatible h1:IfV12K8xAKAnZqdXVzCZ+TOjboZ2keLg81eXfW3O+oY= github.com/golang-jwt/jwt v3.2.2+incompatible/go.mod h1:8pz2t5EyA70fFQQSrl6XZXzqecmYZeUEB8OUGHkxJ+I= -github.com/golang/glog v0.0.0-20160126235308-23def4e6c14b/go.mod h1:SBH7ygxi8pfUlaOkMMuAQtPIUF8ecWP5IEl/CR7VP2Q= -github.com/golang/groupcache v0.0.0-20190702054246-869f871628b6/go.mod h1:cIg4eruTrX1D+g88fzRXU5OdNfaM+9IcxsU14FzY7Hc= -github.com/golang/groupcache v0.0.0-20191227052852-215e87163ea7/go.mod h1:cIg4eruTrX1D+g88fzRXU5OdNfaM+9IcxsU14FzY7Hc= -github.com/golang/groupcache v0.0.0-20200121045136-8c9f03a8e57e/go.mod h1:cIg4eruTrX1D+g88fzRXU5OdNfaM+9IcxsU14FzY7Hc= -github.com/golang/mock v1.1.1/go.mod h1:oTYuIxOrZwtPieC+H1uAHpcLFnEyAGVDL/k47Jfbm0A= -github.com/golang/mock v1.2.0/go.mod h1:oTYuIxOrZwtPieC+H1uAHpcLFnEyAGVDL/k47Jfbm0A= -github.com/golang/mock v1.3.1/go.mod h1:sBzyDLLjw3U8JLTeZvSv8jJB+tU5PVekmnlKIyFUx0Y= -github.com/golang/mock v1.4.0/go.mod h1:UOMv5ysSaYNkG+OFQykRIcU/QvvxJf3p21QfJ2Bt3cw= -github.com/golang/mock v1.4.1/go.mod h1:UOMv5ysSaYNkG+OFQykRIcU/QvvxJf3p21QfJ2Bt3cw= -github.com/golang/mock v1.4.3/go.mod h1:UOMv5ysSaYNkG+OFQykRIcU/QvvxJf3p21QfJ2Bt3cw= -github.com/golang/mock v1.4.4/go.mod h1:l3mdAwkq5BuhzHwde/uurv3sEJeZMXNpwsxVWU71h+4= -github.com/golang/protobuf v1.2.0/go.mod h1:6lQm79b+lXiMfvg/cZm0SGofjICqVBUtrP5yJMmIC1U= -github.com/golang/protobuf v1.3.1/go.mod h1:6lQm79b+lXiMfvg/cZm0SGofjICqVBUtrP5yJMmIC1U= -github.com/golang/protobuf v1.3.2/go.mod h1:6lQm79b+lXiMfvg/cZm0SGofjICqVBUtrP5yJMmIC1U= -github.com/golang/protobuf v1.3.3/go.mod h1:vzj43D7+SQXF/4pzW/hwtAqwc6iTitCiVSaWz5lYuqw= -github.com/golang/protobuf v1.3.4/go.mod h1:vzj43D7+SQXF/4pzW/hwtAqwc6iTitCiVSaWz5lYuqw= -github.com/golang/protobuf v1.3.5/go.mod h1:6O5/vntMXwX2lRkT1hjjk0nAC1IDOTvTlVgjlRvqsdk= -github.com/golang/protobuf v1.4.0-rc.1/go.mod h1:ceaxUfeHdC40wWswd/P6IGgMaK3YpKi5j83Wpe3EHw8= -github.com/golang/protobuf v1.4.0-rc.1.0.20200221234624-67d41d38c208/go.mod h1:xKAWHe0F5eneWXFV3EuXVDTCmh+JuBKY0li0aMyXATA= -github.com/golang/protobuf v1.4.0-rc.2/go.mod h1:LlEzMj4AhA7rCAGe4KMBDvJI+AwstrUpVNzEA03Pprs= -github.com/golang/protobuf v1.4.0-rc.4.0.20200313231945-b860323f09d0/go.mod h1:WU3c8KckQ9AFe+yFwt9sWVRKCVIyN9cPHBJSNnbL67w= -github.com/golang/protobuf v1.4.0/go.mod h1:jodUvKwWbYaEsadDk5Fwe5c77LiNKVO9IDvqG2KuDX0= -github.com/golang/protobuf v1.4.1/go.mod h1:U8fpvMrcmy5pZrNK1lt4xCsGvpyWQ/VVv6QDs8UjoX8= -github.com/golang/protobuf v1.4.2/go.mod h1:oDoupMAO8OvCJWAcko0GGGIgR6R6ocIYbsSw735rRwI= -github.com/golang/protobuf v1.4.3/go.mod h1:oDoupMAO8OvCJWAcko0GGGIgR6R6ocIYbsSw735rRwI= -github.com/google/btree v0.0.0-20180813153112-4030bb1f1f0c/go.mod h1:lNA+9X1NB3Zf8V7Ke586lFgjr2dZNuvo3lPJSGZ5JPQ= -github.com/google/btree v1.0.0/go.mod h1:lNA+9X1NB3Zf8V7Ke586lFgjr2dZNuvo3lPJSGZ5JPQ= -github.com/google/go-cmp v0.2.0/go.mod h1:oXzfMopK8JAjlY9xF4vHSVASa0yLyX7SntLO5aqRK0M= -github.com/google/go-cmp v0.3.0/go.mod h1:8QqcDgzrUqlUb/G2PQTWiueGozuR1884gddMywk6iLU= -github.com/google/go-cmp v0.3.1/go.mod h1:8QqcDgzrUqlUb/G2PQTWiueGozuR1884gddMywk6iLU= -github.com/google/go-cmp v0.4.0/go.mod h1:v8dTdLbMG2kIc/vJvl+f65V22dbkXbowE6jgT/gNBxE= -github.com/google/go-cmp v0.4.1/go.mod h1:v8dTdLbMG2kIc/vJvl+f65V22dbkXbowE6jgT/gNBxE= -github.com/google/go-cmp v0.5.0/go.mod h1:v8dTdLbMG2kIc/vJvl+f65V22dbkXbowE6jgT/gNBxE= -github.com/google/go-cmp v0.5.1/go.mod h1:v8dTdLbMG2kIc/vJvl+f65V22dbkXbowE6jgT/gNBxE= -github.com/google/go-cmp v0.5.2/go.mod h1:v8dTdLbMG2kIc/vJvl+f65V22dbkXbowE6jgT/gNBxE= -github.com/google/go-cmp v0.5.4/go.mod h1:v8dTdLbMG2kIc/vJvl+f65V22dbkXbowE6jgT/gNBxE= github.com/google/go-cmp v0.5.9 h1:O2Tfq5qg4qc4AmwVlvv0oLiVAGB7enBSJ2x2DqQFi38= github.com/google/go-cmp v0.5.9/go.mod h1:17dUlkBOakJ0+DkrSSNjCkIjxS6bF9zb3elmeNGIjoY= -github.com/google/martian v2.1.0+incompatible/go.mod h1:9I4somxYTbIHy5NJKHRl3wXiIaQGbYVAs8BPL6v8lEs= -github.com/google/martian/v3 v3.0.0/go.mod h1:y5Zk1BBys9G+gd6Jrk0W3cC1+ELVxBWuIGO+w/tUAp0= -github.com/google/martian/v3 v3.1.0/go.mod h1:y5Zk1BBys9G+gd6Jrk0W3cC1+ELVxBWuIGO+w/tUAp0= -github.com/google/pprof v0.0.0-20181206194817-3ea8567a2e57/go.mod h1:zfwlbNMJ+OItoe0UupaVj+oy1omPYYDuagoSzA8v9mc= -github.com/google/pprof v0.0.0-20190515194954-54271f7e092f/go.mod h1:zfwlbNMJ+OItoe0UupaVj+oy1omPYYDuagoSzA8v9mc= -github.com/google/pprof v0.0.0-20191218002539-d4f498aebedc/go.mod h1:ZgVRPoUq/hfqzAqh7sHMqb3I9Rq5C59dIz2SbBwJ4eM= -github.com/google/pprof v0.0.0-20200212024743-f11f1df84d12/go.mod h1:ZgVRPoUq/hfqzAqh7sHMqb3I9Rq5C59dIz2SbBwJ4eM= -github.com/google/pprof v0.0.0-20200229191704-1ebb73c60ed3/go.mod h1:ZgVRPoUq/hfqzAqh7sHMqb3I9Rq5C59dIz2SbBwJ4eM= -github.com/google/pprof v0.0.0-20200430221834-fc25d7d30c6d/go.mod h1:ZgVRPoUq/hfqzAqh7sHMqb3I9Rq5C59dIz2SbBwJ4eM= -github.com/google/pprof v0.0.0-20200708004538-1a94d8640e99/go.mod h1:ZgVRPoUq/hfqzAqh7sHMqb3I9Rq5C59dIz2SbBwJ4eM= -github.com/google/pprof v0.0.0-20201023163331-3e6fc7fc9c4c/go.mod h1:kpwsk12EmLew5upagYY7GY0pfYCcupk39gWOCRROcvE= -github.com/google/pprof v0.0.0-20201203190320-1bf35d6f28c2/go.mod h1:kpwsk12EmLew5upagYY7GY0pfYCcupk39gWOCRROcvE= -github.com/google/pprof v0.0.0-20201218002935-b9804c9f04c2/go.mod h1:kpwsk12EmLew5upagYY7GY0pfYCcupk39gWOCRROcvE= -github.com/google/renameio v0.1.0/go.mod h1:KWCgfxg9yswjAJkECMjeO8J8rahYeXnNhOm40UhjYkI= -github.com/google/uuid v1.1.2/go.mod h1:TIyPZe4MgqvfeYDBFedMoGGpEw/LqOeaOT+nhxU+yHo= -github.com/googleapis/gax-go/v2 v2.0.4/go.mod h1:0Wqv26UfaUD9n4G6kQubkQ+KchISgw+vpHVxEJEs9eg= -github.com/googleapis/gax-go/v2 v2.0.5/go.mod h1:DWXyrwAJ9X0FpwwEdw+IPEYBICEFu5mhpdKc/us6bOk= -github.com/googleapis/google-cloud-go-testing v0.0.0-20200911160855-bcd43fbb19e8/go.mod h1:dvDLG8qkwmyD9a/MJJN3XJcT3xFxOKAvTZGvuZmac9g= -github.com/hashicorp/golang-lru v0.5.0/go.mod h1:/m3WP610KZHVQ1SGc6re/UDhFvYD7pJ4Ao+sR/qLZy8= -github.com/hashicorp/golang-lru v0.5.1/go.mod h1:/m3WP610KZHVQ1SGc6re/UDhFvYD7pJ4Ao+sR/qLZy8= github.com/hashicorp/hcl v1.0.0 h1:0Anlzjpi4vEasTeNFn2mLJgTSwt0+6sfsiTG8qcWGx4= github.com/hashicorp/hcl v1.0.0/go.mod h1:E5yfLk+7swimpb2L/Alb/PJmXilQ/rhwaUYs4T20WEQ= -github.com/ianlancetaylor/demangle v0.0.0-20181102032728-5e5cf60278f6/go.mod h1:aSSvb/t6k1mPoxDqO4vJh6VOCGPwU4O0C2/Eqndh1Sc= -github.com/ianlancetaylor/demangle v0.0.0-20200824232613-28f6c0f3b639/go.mod h1:aSSvb/t6k1mPoxDqO4vJh6VOCGPwU4O0C2/Eqndh1Sc= github.com/inconshreveable/mousetrap v1.1.0 h1:wN+x4NVGpMsO7ErUn/mUI3vEoE6Jt13X2s0bqwp9tc8= github.com/inconshreveable/mousetrap v1.1.0/go.mod h1:vpF70FUmC8bwa3OWnCshd2FqLfsEA9PFc4w1p2J65bw= github.com/jackc/fake v0.0.0-20150926172116-812a484cc733 h1:vr3AYkKovP8uR8AvSGGUK1IDqRa5lAAvEkZG1LKaCRc= @@ -147,401 +33,89 @@ github.com/jackc/pgx v3.6.2+incompatible h1:2zP5OD7kiyR3xzRYMhOcXVvkDZsImVXfj+yI github.com/jackc/pgx v3.6.2+incompatible/go.mod h1:0ZGrqGqkRlliWnWB4zKnWtjbSWbGkVEFm4TeybAXq+I= github.com/jmoiron/sqlx v1.3.5 h1:vFFPA71p1o5gAeqtEAwLU4dnX2napprKtHr7PYIcN3g= github.com/jmoiron/sqlx v1.3.5/go.mod h1:nRVWtLre0KfCLJvgxzCsLVMogSvQ1zNJtpYr2Ccp0mQ= -github.com/jstemmer/go-junit-report v0.0.0-20190106144839-af01ea7f8024/go.mod h1:6v2b51hI/fHJwM22ozAgKL4VKDeJcHhJFhtBdhmNjmU= -github.com/jstemmer/go-junit-report v0.9.1/go.mod h1:Brl9GWCQeLvo8nXZwPNNblvFj/XSXhF0NWZEnDohbsk= -github.com/kisielk/gotool v1.0.0/go.mod h1:XhKaO+MFFWcvkIS/tQcRk01m1F5IRFswLeQ+oQHNcck= -github.com/kr/fs v0.1.0/go.mod h1:FFnZGqtBN9Gxj7eW1uZ42v5BccTP0vu6NEaFoC2HwRg= -github.com/kr/pretty v0.1.0/go.mod h1:dAy3ld7l9f0ibDNOQOHHMYYIIbhfbHSm3C4ZsoJORNo= github.com/kr/pretty v0.3.1 h1:flRD4NNwYAUpkphVc1HcthR4KEIFJ65n8Mw5qdRn3LE= github.com/kr/pretty v0.3.1/go.mod h1:hoEshYVHaxMs3cyo3Yncou5ZscifuDolrwPKZanG3xk= -github.com/kr/pty v1.1.1/go.mod h1:pFQYn66WHrOpPYNljwOMqo10TkYh1fy3cYio2l3bCsQ= -github.com/kr/text v0.1.0/go.mod h1:4Jbv+DJW3UT/LiOwJeYQe1efqtUx/iVham/4vfdArNI= github.com/kr/text v0.2.0 h1:5Nx0Ya0ZqY2ygV366QzturHI13Jq95ApcVaJBhpS+AY= github.com/kr/text v0.2.0/go.mod h1:eLer722TekiGuMkidMxC/pM04lWEeraHUUmBw8l2grE= -github.com/labstack/echo/v4 v4.11.1 h1:dEpLU2FLg4UVmvCGPuk/APjlH6GDpbEPti61srUUUs4= -github.com/labstack/echo/v4 v4.11.1/go.mod h1:YuYRTSM3CHs2ybfrL8Px48bO6BAnYIN4l8wSTMP6BDQ= -github.com/labstack/gommon v0.4.0 h1:y7cvthEAEbU0yHOf4axH8ZG2NH8knB9iNSoTO8dyIk8= -github.com/labstack/gommon v0.4.0/go.mod h1:uW6kP17uPlLJsD3ijUYn3/M5bAxtlZhMI6m3MFxTMTM= +github.com/labstack/echo/v4 v4.11.4 h1:vDZmA+qNeh1pd/cCkEicDMrjtrnMGQ1QFI9gWN1zGq8= +github.com/labstack/echo/v4 v4.11.4/go.mod h1:noh7EvLwqDsmh/X/HWKPUl1AjzJrhyptRyEbQJfxen8= +github.com/labstack/gommon v0.4.2 h1:F8qTUNXgG1+6WQmqoUWnz8WiEU60mXVVw0P4ht1WRA0= +github.com/labstack/gommon v0.4.2/go.mod h1:QlUFxVM+SNXhDL/Z7YhocGIBYOiwB0mXm1+1bAPHPyU= github.com/lib/pq v1.2.0 h1:LXpIM/LZ5xGFhOpXAQUIMM1HdyqzVYM13zNdjCEEcA0= github.com/lib/pq v1.2.0/go.mod h1:5WUZQaWbwv1U+lTReE5YruASi9Al49XbQIvNi/34Woo= github.com/magiconair/properties v1.8.7 h1:IeQXZAiQcpL9mgcAe1Nu6cX9LLw6ExEHKjN0VQdvPDY= github.com/magiconair/properties v1.8.7/go.mod h1:Dhd985XPs7jluiymwWYZ0G4Z61jb3vdS329zhj2hYo0= -github.com/mattn/go-colorable v0.1.11/go.mod h1:u5H1YNBxpqRaxsYJYSkiCWKzEfiAb1Gb520KVy5xxl4= github.com/mattn/go-colorable v0.1.13 h1:fFA4WZxdEF4tXPZVKMLwD8oUnCTTo08duU7wxecdEvA= github.com/mattn/go-colorable v0.1.13/go.mod h1:7S9/ev0klgBDR4GtXTXX8a3vIGJpMovkB8vQcUbaXHg= -github.com/mattn/go-isatty v0.0.14/go.mod h1:7GGIvUiUoEMVVmxf/4nioHXj79iQHKdU27kJ6hsGG94= github.com/mattn/go-isatty v0.0.16/go.mod h1:kYGgaQfpe5nmfYZH+SKPsOc2e4SrIfOl2e/yFXSvRLM= -github.com/mattn/go-isatty v0.0.19 h1:JITubQf0MOLdlGRuRq+jtsDlekdYPia9ZFsB8h/APPA= -github.com/mattn/go-isatty v0.0.19/go.mod h1:W+V8PltTTMOvKvAeJH7IuucS94S2C6jfK/D7dTCTo3Y= +github.com/mattn/go-isatty v0.0.20 h1:xfD0iDuEKnDkl03q4limB+vH+GxLEtL/jb4xVJSWWEY= +github.com/mattn/go-isatty v0.0.20/go.mod h1:W+V8PltTTMOvKvAeJH7IuucS94S2C6jfK/D7dTCTo3Y= github.com/mattn/go-sqlite3 v1.14.6 h1:dNPt6NO46WmLVt2DLNpwczCmdV5boIZ6g/tlDrlRUbg= github.com/mattn/go-sqlite3 v1.14.6/go.mod h1:NyWgC/yNuGj7Q9rpYnZvas74GogHl5/Z4A/KQRfk6bU= github.com/mitchellh/mapstructure v1.5.0 h1:jeMsZIYE/09sWLaz43PL7Gy6RuMjD2eJVyuac5Z2hdY= github.com/mitchellh/mapstructure v1.5.0/go.mod h1:bFUtVrKA4DC2yAKiSyO/QUcy7e+RRV2QTWOzhPopBRo= -github.com/pelletier/go-toml/v2 v2.0.8 h1:0ctb6s9mE31h0/lhu+J6OPmVeDxJn+kYnJc2jZR9tGQ= -github.com/pelletier/go-toml/v2 v2.0.8/go.mod h1:vuYfssBdrU2XDZ9bYydBu6t+6a6PYNcZljzZR9VXg+4= +github.com/pelletier/go-toml/v2 v2.1.1 h1:LWAJwfNvjQZCFIDKWYQaM62NcYeYViCmWIwmOStowAI= +github.com/pelletier/go-toml/v2 v2.1.1/go.mod h1:tJU2Z3ZkXwnxa4DPO899bsyIoywizdUvyaeZurnPPDc= github.com/pkg/errors v0.9.1 h1:FEBLx1zS214owpjy7qsBeixbURkuhQAwrK5UwLGTwt4= github.com/pkg/errors v0.9.1/go.mod h1:bwawxfHBFNV+L2hUp1rHADufV3IMtnDRdf1r5NINEl0= -github.com/pkg/sftp v1.13.1/go.mod h1:3HaPG6Dq1ILlpPZRO0HVMrsydcdLt6HRDccSgb87qRg= -github.com/pmezard/go-difflib v1.0.0 h1:4DBwDE0NGyQoBHbLQYPwSUPoCMWR5BEzIk/f1lZbAQM= github.com/pmezard/go-difflib v1.0.0/go.mod h1:iKH77koFhYxTK1pcRnkKkqfTogsbg7gZNVY4sRDYZ/4= -github.com/prometheus/client_model v0.0.0-20190812154241-14fe0d1b01d4/go.mod h1:xMI15A0UPsDsEKsMN9yxemIoYk6Tm2C1GtYGdfGttqA= -github.com/rogpeppe/go-internal v1.3.0/go.mod h1:M8bDsm7K2OlrFYOpmOWEs/qY81heoFRclV5y23lUDJ4= +github.com/pmezard/go-difflib v1.0.1-0.20181226105442-5d4384ee4fb2 h1:Jamvg5psRIccs7FGNTlIRMkT8wgtp5eCXdBlqhYGL6U= +github.com/pmezard/go-difflib v1.0.1-0.20181226105442-5d4384ee4fb2/go.mod h1:iKH77koFhYxTK1pcRnkKkqfTogsbg7gZNVY4sRDYZ/4= github.com/rogpeppe/go-internal v1.9.0 h1:73kH8U+JUqXU8lRuOHeVHaa/SZPifC7BkcraZVejAe8= github.com/rogpeppe/go-internal v1.9.0/go.mod h1:WtVeX8xhTBvf0smdhujwtBcq4Qrzq/fJaraNFVN+nFs= github.com/russross/blackfriday/v2 v2.1.0/go.mod h1:+Rmxgy9KzJVeS9/2gXHxylqXiyQDYRxCVz55jmeOWTM= +github.com/sagikazarmark/locafero v0.4.0 h1:HApY1R9zGo4DBgr7dqsTH/JJxLTTsOt7u6keLGt6kNQ= +github.com/sagikazarmark/locafero v0.4.0/go.mod h1:Pe1W6UlPYUk/+wc/6KFhbORCfqzgYEpgQ3O5fPuL3H4= +github.com/sagikazarmark/slog-shim v0.1.0 h1:diDBnUNK9N/354PgrxMywXnAwEr1QZcOr6gto+ugjYE= +github.com/sagikazarmark/slog-shim v0.1.0/go.mod h1:SrcSrq8aKtyuqEI1uvTDTK1arOWRIczQRv+GVI1AkeQ= github.com/shopspring/decimal v1.3.1 h1:2Usl1nmF/WZucqkFZhnfFYxxxu8LG21F6nPQBE5gKV8= github.com/shopspring/decimal v1.3.1/go.mod h1:DKyhrW/HYNuLGql+MJL6WCR6knT2jwCFRcu2hWCYk4o= -github.com/spf13/afero v1.9.5 h1:stMpOSZFs//0Lv29HduCmli3GUfpFoF3Y1Q/aXj/wVM= -github.com/spf13/afero v1.9.5/go.mod h1:UBogFpq8E9Hx+xc5CNTTEpTnuHVmXDwZcZcE1eb/UhQ= -github.com/spf13/cast v1.5.1 h1:R+kOtfhWQE6TVQzY+4D7wJLBgkdVasCEFxSUBYBYIlA= -github.com/spf13/cast v1.5.1/go.mod h1:b9PdjNptOpzXr7Rq1q9gJML/2cdGQAo69NKzQ10KN48= -github.com/spf13/cobra v1.7.0 h1:hyqWnYt1ZQShIddO5kBpj3vu05/++x6tJ6dg8EC572I= -github.com/spf13/cobra v1.7.0/go.mod h1:uLxZILRyS/50WlhOIKD7W6V5bgeIt+4sICxh6uRMrb0= -github.com/spf13/jwalterweatherman v1.1.0 h1:ue6voC5bR5F8YxI5S67j9i582FU4Qvo2bmqnqMYADFk= -github.com/spf13/jwalterweatherman v1.1.0/go.mod h1:aNWZUN0dPAAO/Ljvb5BEdw96iTZ0EXowPYD95IqWIGo= +github.com/sourcegraph/conc v0.3.0 h1:OQTbbt6P72L20UqAkXXuLOj79LfEanQ+YQFNpLA9ySo= +github.com/sourcegraph/conc v0.3.0/go.mod h1:Sdozi7LEKbFPqYX2/J+iBAM6HpqSLTASQIKqDmF7Mt0= +github.com/spf13/afero v1.11.0 h1:WJQKhtpdm3v2IzqG8VMqrr6Rf3UYpEF239Jy9wNepM8= +github.com/spf13/afero v1.11.0/go.mod h1:GH9Y3pIexgf1MTIWtNGyogA5MwRIDXGUr+hbWNoBjkY= +github.com/spf13/cast v1.6.0 h1:GEiTHELF+vaR5dhz3VqZfFSzZjYbgeKDpBxQVS4GYJ0= +github.com/spf13/cast v1.6.0/go.mod h1:ancEpBxwJDODSW/UG4rDrAqiKolqNNh2DX3mk86cAdo= +github.com/spf13/cobra v1.8.0 h1:7aJaZx1B85qltLMc546zn58BxxfZdR/W22ej9CFoEf0= +github.com/spf13/cobra v1.8.0/go.mod h1:WXLWApfZ71AjXPya3WOlMsY9yMs7YeiHhFVlvLyhcho= github.com/spf13/pflag v1.0.5 h1:iy+VFUOCP1a+8yFto/drg2CJ5u0yRoB7fZw3DKv/JXA= github.com/spf13/pflag v1.0.5/go.mod h1:McXfInJRrz4CZXVZOBLb0bTZqETkiAhM9Iw0y3An2Bg= -github.com/spf13/viper v1.16.0 h1:rGGH0XDZhdUOryiDWjmIvUSWpbNqisK8Wk0Vyefw8hc= -github.com/spf13/viper v1.16.0/go.mod h1:yg78JgCJcbrQOvV9YLXgkLaZqUidkY9K+Dd1FofRzQg= +github.com/spf13/viper v1.18.2 h1:LUXCnvUvSM6FXAsj6nnfc8Q2tp1dIgUfY9Kc8GsSOiQ= +github.com/spf13/viper v1.18.2/go.mod h1:EKmWIqdnk5lOcmR72yw6hS+8OPYcwD0jteitLMVB+yk= github.com/stretchr/objx v0.1.0/go.mod h1:HFkY916IF+rwdDfMAkV7OtwuqBVzrE8GR6GFx+wExME= github.com/stretchr/objx v0.4.0/go.mod h1:YvHI0jy2hoMjB+UWwv71VJQ9isScKT/TqJzVSSt89Yw= github.com/stretchr/objx v0.5.0/go.mod h1:Yh+to48EsGEfYuaHDzXPcE3xhTkx73EhmCGUpEOglKo= -github.com/stretchr/testify v1.2.2/go.mod h1:a8OnRcib4nhh0OaRAV+Yts87kKdq0PP7pXfy6kDkUVs= -github.com/stretchr/testify v1.4.0/go.mod h1:j7eGeouHqKxXV5pUuKE4zz7dFj8WfuZ+81PSLYec5m4= -github.com/stretchr/testify v1.5.1/go.mod h1:5W2xD1RspED5o8YsWQXVCued0rvSQ+mT+I5cxcmMvtA= -github.com/stretchr/testify v1.7.0/go.mod h1:6Fq8oRcR53rry900zMqJjRRixrwX3KX962/h/Wwjteg= github.com/stretchr/testify v1.7.1/go.mod h1:6Fq8oRcR53rry900zMqJjRRixrwX3KX962/h/Wwjteg= github.com/stretchr/testify v1.8.0/go.mod h1:yNjHg4UonilssWZ8iaSj1OCr/vHnekPRkoO+kdMU+MU= -github.com/stretchr/testify v1.8.3 h1:RP3t2pwF7cMEbC1dqtB6poj3niw/9gnV4Cjg5oW5gtY= -github.com/stretchr/testify v1.8.3/go.mod h1:sz/lmYIOXD/1dqDmKjjqLyZ2RngseejIcXlSw2iwfAo= -github.com/subosito/gotenv v1.4.2 h1:X1TuBLAMDFbaTAChgCBLu3DU3UPyELpnF2jjJ2cz/S8= -github.com/subosito/gotenv v1.4.2/go.mod h1:ayKnFf/c6rvx/2iiLrJUk1e6plDbT3edrFNGqEflhK0= +github.com/stretchr/testify v1.8.4 h1:CcVxjf3Q8PM0mHUKJCdn+eZZtm5yQwehR5yeSVQQcUk= +github.com/stretchr/testify v1.8.4/go.mod h1:sz/lmYIOXD/1dqDmKjjqLyZ2RngseejIcXlSw2iwfAo= +github.com/subosito/gotenv v1.6.0 h1:9NlTDc1FTs4qu0DDq7AEtTPNw6SVm7uBMsUCUjABIf8= +github.com/subosito/gotenv v1.6.0/go.mod h1:Dk4QP5c2W3ibzajGcXpNraDfq2IrhjMIvMSWPKKo0FU= github.com/valyala/bytebufferpool v1.0.0 h1:GqA5TC/0021Y/b9FG4Oi9Mr3q7XYx6KllzawFIhcdPw= github.com/valyala/bytebufferpool v1.0.0/go.mod h1:6bBcMArwyJ5K/AmCkWv1jt77kVWyCJ6HpOuEn7z0Csc= -github.com/valyala/fasttemplate v1.2.1/go.mod h1:KHLXt3tVN2HBp8eijSv/kGJopbvo7S+qRAEEKiv+SiQ= github.com/valyala/fasttemplate v1.2.2 h1:lxLXG0uE3Qnshl9QyaK6XJxMXlQZELvChBOCmQD0Loo= github.com/valyala/fasttemplate v1.2.2/go.mod h1:KHLXt3tVN2HBp8eijSv/kGJopbvo7S+qRAEEKiv+SiQ= -github.com/yuin/goldmark v1.1.25/go.mod h1:3hX8gzYuyVAZsxl0MRgGTJEmQBFcNTphYh9decYSb74= -github.com/yuin/goldmark v1.1.27/go.mod h1:3hX8gzYuyVAZsxl0MRgGTJEmQBFcNTphYh9decYSb74= -github.com/yuin/goldmark v1.1.32/go.mod h1:3hX8gzYuyVAZsxl0MRgGTJEmQBFcNTphYh9decYSb74= -github.com/yuin/goldmark v1.2.1/go.mod h1:3hX8gzYuyVAZsxl0MRgGTJEmQBFcNTphYh9decYSb74= -go.opencensus.io v0.21.0/go.mod h1:mSImk1erAIZhrmZN+AvHh14ztQfjbGwt4TtuofqLduU= -go.opencensus.io v0.22.0/go.mod h1:+kGneAE2xo2IficOXnaByMWTGM9T73dGwxeWcUqIpI8= -go.opencensus.io v0.22.2/go.mod h1:yxeiOL68Rb0Xd1ddK5vPZ/oVn4vY4Ynel7k9FzqtOIw= -go.opencensus.io v0.22.3/go.mod h1:yxeiOL68Rb0Xd1ddK5vPZ/oVn4vY4Ynel7k9FzqtOIw= -go.opencensus.io v0.22.4/go.mod h1:yxeiOL68Rb0Xd1ddK5vPZ/oVn4vY4Ynel7k9FzqtOIw= -go.opencensus.io v0.22.5/go.mod h1:5pWMHQbX5EPX2/62yrJeAkowc+lfs/XD7Uxpq3pI6kk= -golang.org/x/crypto v0.0.0-20190308221718-c2843e01d9a2/go.mod h1:djNgcEr1/C05ACkg1iLfiJU5Ep61QUkGW8qpdssI0+w= -golang.org/x/crypto v0.0.0-20190510104115-cbcb75029529/go.mod h1:yigFU9vqHzYiE8UmvKecakEJjdnWj3jj499lnFckfCI= -golang.org/x/crypto v0.0.0-20190605123033-f99c8df09eb5/go.mod h1:yigFU9vqHzYiE8UmvKecakEJjdnWj3jj499lnFckfCI= -golang.org/x/crypto v0.0.0-20191011191535-87dc89f01550/go.mod h1:yigFU9vqHzYiE8UmvKecakEJjdnWj3jj499lnFckfCI= -golang.org/x/crypto v0.0.0-20200622213623-75b288015ac9/go.mod h1:LzIPMQfyMNhhGPhUkYOs5KpL4U8rLKemX1yGLhDgUto= -golang.org/x/crypto v0.0.0-20210421170649-83a5a9bb288b/go.mod h1:T9bdIzuCu7OtxOm1hfPfRQxPLYneinmdGuTeoZ9dtd4= -golang.org/x/crypto v0.0.0-20220722155217-630584e8d5aa/go.mod h1:IxCIyHEi3zRg3s0A5j5BB6A9Jmi73HwBIUl50j+osU4= -golang.org/x/crypto v0.11.0 h1:6Ewdq3tDic1mg5xRO4milcWCfMVQhI4NkqWWvqejpuA= -golang.org/x/crypto v0.11.0/go.mod h1:xgJhtzW8F9jGdVFWZESrid1U1bjeNy4zgy5cRr/CIio= -golang.org/x/exp v0.0.0-20190121172915-509febef88a4/go.mod h1:CJ0aWSM057203Lf6IL+f9T1iT9GByDxfZKAQTCR3kQA= -golang.org/x/exp v0.0.0-20190306152737-a1d7652674e8/go.mod h1:CJ0aWSM057203Lf6IL+f9T1iT9GByDxfZKAQTCR3kQA= -golang.org/x/exp v0.0.0-20190510132918-efd6b22b2522/go.mod h1:ZjyILWgesfNpC6sMxTJOJm9Kp84zZh5NQWvqDGG3Qr8= -golang.org/x/exp v0.0.0-20190829153037-c13cbed26979/go.mod h1:86+5VVa7VpoJ4kLfm080zCjGlMRFzhUhsZKEZO7MGek= -golang.org/x/exp v0.0.0-20191030013958-a1ab85dbe136/go.mod h1:JXzH8nQsPlswgeRAPE3MuO9GYsAcnJvJ4vnMwN/5qkY= -golang.org/x/exp v0.0.0-20191129062945-2f5052295587/go.mod h1:2RIsYlXP63K8oxa1u096TMicItID8zy7Y6sNkU49FU4= -golang.org/x/exp v0.0.0-20191227195350-da58074b4299/go.mod h1:2RIsYlXP63K8oxa1u096TMicItID8zy7Y6sNkU49FU4= -golang.org/x/exp v0.0.0-20200119233911-0405dc783f0a/go.mod h1:2RIsYlXP63K8oxa1u096TMicItID8zy7Y6sNkU49FU4= -golang.org/x/exp v0.0.0-20200207192155-f17229e696bd/go.mod h1:J/WKrq2StrnmMY6+EHIKF9dgMWnmCNThgcyBT1FY9mM= -golang.org/x/exp v0.0.0-20200224162631-6cc2880d07d6/go.mod h1:3jZMyOhIsHpP37uCMkUooju7aAi5cS1Q23tOzKc+0MU= -golang.org/x/image v0.0.0-20190227222117-0694c2d4d067/go.mod h1:kZ7UVZpmo3dzQBMxlp+ypCbDeSB+sBbTgSJuh5dn5js= -golang.org/x/image v0.0.0-20190802002840-cff245a6509b/go.mod h1:FeLwcggjj3mMvU+oOTbSwawSJRM1uh48EjtB4UJZlP0= -golang.org/x/lint v0.0.0-20181026193005-c67002cb31c3/go.mod h1:UVdnD1Gm6xHRNCYTkRU2/jEulfH38KcIWyp/GAMgvoE= -golang.org/x/lint v0.0.0-20190227174305-5b3e6a55c961/go.mod h1:wehouNa3lNwaWXcvxsM5YxQ5yQlVC4a0KAMCusXpPoU= -golang.org/x/lint v0.0.0-20190301231843-5614ed5bae6f/go.mod h1:UVdnD1Gm6xHRNCYTkRU2/jEulfH38KcIWyp/GAMgvoE= -golang.org/x/lint v0.0.0-20190313153728-d0100b6bd8b3/go.mod h1:6SW0HCj/g11FgYtHlgUYUwCkIfeOF89ocIRzGO/8vkc= -golang.org/x/lint v0.0.0-20190409202823-959b441ac422/go.mod h1:6SW0HCj/g11FgYtHlgUYUwCkIfeOF89ocIRzGO/8vkc= -golang.org/x/lint v0.0.0-20190909230951-414d861bb4ac/go.mod h1:6SW0HCj/g11FgYtHlgUYUwCkIfeOF89ocIRzGO/8vkc= -golang.org/x/lint v0.0.0-20190930215403-16217165b5de/go.mod h1:6SW0HCj/g11FgYtHlgUYUwCkIfeOF89ocIRzGO/8vkc= -golang.org/x/lint v0.0.0-20191125180803-fdd1cda4f05f/go.mod h1:5qLYkcX4OjUUV8bRuDixDT3tpyyb+LUpUlRWLxfhWrs= -golang.org/x/lint v0.0.0-20200130185559-910be7a94367/go.mod h1:3xt1FjdF8hUf6vQPIChWIBhFzV8gjjsPE/fR3IyQdNY= -golang.org/x/lint v0.0.0-20200302205851-738671d3881b/go.mod h1:3xt1FjdF8hUf6vQPIChWIBhFzV8gjjsPE/fR3IyQdNY= -golang.org/x/lint v0.0.0-20201208152925-83fdc39ff7b5/go.mod h1:3xt1FjdF8hUf6vQPIChWIBhFzV8gjjsPE/fR3IyQdNY= -golang.org/x/mobile v0.0.0-20190312151609-d3739f865fa6/go.mod h1:z+o9i4GpDbdi3rU15maQ/Ox0txvL9dWGYEHz965HBQE= -golang.org/x/mobile v0.0.0-20190719004257-d2bd2a29d028/go.mod h1:E/iHnbuqvinMTCcRqshq8CkpyQDoeVncDDYHnLhea+o= -golang.org/x/mod v0.0.0-20190513183733-4bf6d317e70e/go.mod h1:mXi4GBBbnImb6dmsKGUJ2LatrhH/nqhxcFungHvyanc= -golang.org/x/mod v0.1.0/go.mod h1:0QHyrYULN0/3qlju5TqG8bIK38QM8yzMo5ekMj3DlcY= -golang.org/x/mod v0.1.1-0.20191105210325-c90efee705ee/go.mod h1:QqPTAvyqsEbceGzBzNggFXnrqF1CaUcvgkdR5Ot7KZg= -golang.org/x/mod v0.1.1-0.20191107180719-034126e5016b/go.mod h1:QqPTAvyqsEbceGzBzNggFXnrqF1CaUcvgkdR5Ot7KZg= -golang.org/x/mod v0.2.0/go.mod h1:s0Qsj1ACt9ePp/hMypM3fl4fZqREWJwdYDEqhRiZZUA= -golang.org/x/mod v0.3.0/go.mod h1:s0Qsj1ACt9ePp/hMypM3fl4fZqREWJwdYDEqhRiZZUA= -golang.org/x/mod v0.4.0/go.mod h1:s0Qsj1ACt9ePp/hMypM3fl4fZqREWJwdYDEqhRiZZUA= -golang.org/x/mod v0.4.1/go.mod h1:s0Qsj1ACt9ePp/hMypM3fl4fZqREWJwdYDEqhRiZZUA= -golang.org/x/net v0.0.0-20180724234803-3673e40ba225/go.mod h1:mL1N/T3taQHkDXs73rZJwtUhF3w3ftmwwsq0BUmARs4= -golang.org/x/net v0.0.0-20180826012351-8a410e7b638d/go.mod h1:mL1N/T3taQHkDXs73rZJwtUhF3w3ftmwwsq0BUmARs4= -golang.org/x/net v0.0.0-20190108225652-1e06a53dbb7e/go.mod h1:mL1N/T3taQHkDXs73rZJwtUhF3w3ftmwwsq0BUmARs4= -golang.org/x/net v0.0.0-20190213061140-3a22650c66bd/go.mod h1:mL1N/T3taQHkDXs73rZJwtUhF3w3ftmwwsq0BUmARs4= -golang.org/x/net v0.0.0-20190311183353-d8887717615a/go.mod h1:t9HGtf8HONx5eT2rtn7q6eTqICYqUVnKs3thJo3Qplg= -golang.org/x/net v0.0.0-20190404232315-eb5bcb51f2a3/go.mod h1:t9HGtf8HONx5eT2rtn7q6eTqICYqUVnKs3thJo3Qplg= -golang.org/x/net v0.0.0-20190501004415-9ce7a6920f09/go.mod h1:t9HGtf8HONx5eT2rtn7q6eTqICYqUVnKs3thJo3Qplg= -golang.org/x/net v0.0.0-20190503192946-f4e77d36d62c/go.mod h1:t9HGtf8HONx5eT2rtn7q6eTqICYqUVnKs3thJo3Qplg= -golang.org/x/net v0.0.0-20190603091049-60506f45cf65/go.mod h1:HSz+uSET+XFnRR8LxR5pz3Of3rY3CfYBVs4xY44aLks= -golang.org/x/net v0.0.0-20190620200207-3b0461eec859/go.mod h1:z5CRVTTTmAJ677TzLLGU+0bjPO0LkuOLi4/5GtJWs/s= -golang.org/x/net v0.0.0-20190628185345-da137c7871d7/go.mod h1:z5CRVTTTmAJ677TzLLGU+0bjPO0LkuOLi4/5GtJWs/s= -golang.org/x/net v0.0.0-20190724013045-ca1201d0de80/go.mod h1:z5CRVTTTmAJ677TzLLGU+0bjPO0LkuOLi4/5GtJWs/s= -golang.org/x/net v0.0.0-20191209160850-c0dbc17a3553/go.mod h1:z5CRVTTTmAJ677TzLLGU+0bjPO0LkuOLi4/5GtJWs/s= -golang.org/x/net v0.0.0-20200114155413-6afb5195e5aa/go.mod h1:z5CRVTTTmAJ677TzLLGU+0bjPO0LkuOLi4/5GtJWs/s= -golang.org/x/net v0.0.0-20200202094626-16171245cfb2/go.mod h1:z5CRVTTTmAJ677TzLLGU+0bjPO0LkuOLi4/5GtJWs/s= -golang.org/x/net v0.0.0-20200222125558-5a598a2470a0/go.mod h1:z5CRVTTTmAJ677TzLLGU+0bjPO0LkuOLi4/5GtJWs/s= -golang.org/x/net v0.0.0-20200226121028-0de0cce0169b/go.mod h1:z5CRVTTTmAJ677TzLLGU+0bjPO0LkuOLi4/5GtJWs/s= -golang.org/x/net v0.0.0-20200301022130-244492dfa37a/go.mod h1:z5CRVTTTmAJ677TzLLGU+0bjPO0LkuOLi4/5GtJWs/s= -golang.org/x/net v0.0.0-20200324143707-d3edc9973b7e/go.mod h1:qpuaurCH72eLCgpAm/N6yyVIVM9cpaDIP3A8BGJEC5A= -golang.org/x/net v0.0.0-20200501053045-e0ff5e5a1de5/go.mod h1:qpuaurCH72eLCgpAm/N6yyVIVM9cpaDIP3A8BGJEC5A= -golang.org/x/net v0.0.0-20200506145744-7e3656a0809f/go.mod h1:qpuaurCH72eLCgpAm/N6yyVIVM9cpaDIP3A8BGJEC5A= -golang.org/x/net v0.0.0-20200513185701-a91f0712d120/go.mod h1:qpuaurCH72eLCgpAm/N6yyVIVM9cpaDIP3A8BGJEC5A= -golang.org/x/net v0.0.0-20200520182314-0ba52f642ac2/go.mod h1:qpuaurCH72eLCgpAm/N6yyVIVM9cpaDIP3A8BGJEC5A= -golang.org/x/net v0.0.0-20200625001655-4c5254603344/go.mod h1:/O7V0waA8r7cgGh81Ro3o1hOxt32SMVPicZroKQ2sZA= -golang.org/x/net v0.0.0-20200707034311-ab3426394381/go.mod h1:/O7V0waA8r7cgGh81Ro3o1hOxt32SMVPicZroKQ2sZA= -golang.org/x/net v0.0.0-20200822124328-c89045814202/go.mod h1:/O7V0waA8r7cgGh81Ro3o1hOxt32SMVPicZroKQ2sZA= -golang.org/x/net v0.0.0-20201021035429-f5854403a974/go.mod h1:sp8m0HH+o8qH0wwXwYZr8TS3Oi6o0r6Gce1SSxlDquU= -golang.org/x/net v0.0.0-20201031054903-ff519b6c9102/go.mod h1:sp8m0HH+o8qH0wwXwYZr8TS3Oi6o0r6Gce1SSxlDquU= -golang.org/x/net v0.0.0-20201209123823-ac852fbbde11/go.mod h1:m0MpNAwzfU5UDzcl9v0D8zg8gWTRqZa9RBIspLL5mdg= -golang.org/x/net v0.0.0-20201224014010-6772e930b67b/go.mod h1:m0MpNAwzfU5UDzcl9v0D8zg8gWTRqZa9RBIspLL5mdg= -golang.org/x/net v0.0.0-20210226172049-e18ecbb05110/go.mod h1:m0MpNAwzfU5UDzcl9v0D8zg8gWTRqZa9RBIspLL5mdg= -golang.org/x/net v0.0.0-20211112202133-69e39bad7dc2/go.mod h1:9nx3DQGgdP8bBQD5qxJ1jj9UTztislL4KSBs9R2vV5Y= -golang.org/x/net v0.12.0 h1:cfawfvKITfUsFCeJIHJrbSxpeu/E81khclypR0GVT50= -golang.org/x/net v0.12.0/go.mod h1:zEVYFnQC7m/vmpQFELhcD1EWkZlX69l4oqgmer6hfKA= -golang.org/x/oauth2 v0.0.0-20180821212333-d2e6202438be/go.mod h1:N/0e6XlmueqKjAGxoOufVs8QHGRruUQn6yWY3a++T0U= -golang.org/x/oauth2 v0.0.0-20190226205417-e64efc72b421/go.mod h1:gOpvHmFTYa4IltrdGE7lF6nIHvwfUNPOp7c8zoXwtLw= -golang.org/x/oauth2 v0.0.0-20190604053449-0f29369cfe45/go.mod h1:gOpvHmFTYa4IltrdGE7lF6nIHvwfUNPOp7c8zoXwtLw= -golang.org/x/oauth2 v0.0.0-20191202225959-858c2ad4c8b6/go.mod h1:gOpvHmFTYa4IltrdGE7lF6nIHvwfUNPOp7c8zoXwtLw= -golang.org/x/oauth2 v0.0.0-20200107190931-bf48bf16ab8d/go.mod h1:gOpvHmFTYa4IltrdGE7lF6nIHvwfUNPOp7c8zoXwtLw= -golang.org/x/oauth2 v0.0.0-20200902213428-5d25da1a8d43/go.mod h1:KelEdhl1UZF7XfJ4dDtk6s++YSgaE7mD/BuKKDLBl4A= -golang.org/x/oauth2 v0.0.0-20201109201403-9fd604954f58/go.mod h1:KelEdhl1UZF7XfJ4dDtk6s++YSgaE7mD/BuKKDLBl4A= -golang.org/x/oauth2 v0.0.0-20201208152858-08078c50e5b5/go.mod h1:KelEdhl1UZF7XfJ4dDtk6s++YSgaE7mD/BuKKDLBl4A= -golang.org/x/oauth2 v0.0.0-20210218202405-ba52d332ba99/go.mod h1:KelEdhl1UZF7XfJ4dDtk6s++YSgaE7mD/BuKKDLBl4A= -golang.org/x/sync v0.0.0-20180314180146-1d60e4601c6f/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= -golang.org/x/sync v0.0.0-20181108010431-42b317875d0f/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= -golang.org/x/sync v0.0.0-20181221193216-37e7f081c4d4/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= -golang.org/x/sync v0.0.0-20190227155943-e225da77a7e6/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= -golang.org/x/sync v0.0.0-20190423024810-112230192c58/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= -golang.org/x/sync v0.0.0-20190911185100-cd5d95a43a6e/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= -golang.org/x/sync v0.0.0-20200317015054-43a5402ce75a/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= -golang.org/x/sync v0.0.0-20200625203802-6e8e738ad208/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= -golang.org/x/sync v0.0.0-20201020160332-67f06af15bc9/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= -golang.org/x/sync v0.0.0-20201207232520-09787c993a3a/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= -golang.org/x/sys v0.0.0-20180830151530-49385e6e1522/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY= -golang.org/x/sys v0.0.0-20190215142949-d0b11bdaac8a/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY= -golang.org/x/sys v0.0.0-20190312061237-fead79001313/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= -golang.org/x/sys v0.0.0-20190412213103-97732733099d/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= -golang.org/x/sys v0.0.0-20190502145724-3ef323f4f1fd/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= -golang.org/x/sys v0.0.0-20190507160741-ecd444e8653b/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= -golang.org/x/sys v0.0.0-20190606165138-5da285871e9c/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= -golang.org/x/sys v0.0.0-20190624142023-c5567b49c5d0/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= -golang.org/x/sys v0.0.0-20190726091711-fc99dfbffb4e/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= -golang.org/x/sys v0.0.0-20191001151750-bb3f8db39f24/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= -golang.org/x/sys v0.0.0-20191204072324-ce4227a45e2e/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= -golang.org/x/sys v0.0.0-20191228213918-04cbcbbfeed8/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= -golang.org/x/sys v0.0.0-20200113162924-86b910548bc1/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= -golang.org/x/sys v0.0.0-20200122134326-e047566fdf82/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= -golang.org/x/sys v0.0.0-20200202164722-d101bd2416d5/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= -golang.org/x/sys v0.0.0-20200212091648-12a6c2dcc1e4/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= -golang.org/x/sys v0.0.0-20200223170610-d5e6a3e2c0ae/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= -golang.org/x/sys v0.0.0-20200302150141-5c8b2ff67527/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= -golang.org/x/sys v0.0.0-20200323222414-85ca7c5b95cd/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= -golang.org/x/sys v0.0.0-20200331124033-c3d80250170d/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= -golang.org/x/sys v0.0.0-20200501052902-10377860bb8e/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= -golang.org/x/sys v0.0.0-20200511232937-7e40ca221e25/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= -golang.org/x/sys v0.0.0-20200515095857-1151b9dac4a9/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= -golang.org/x/sys v0.0.0-20200523222454-059865788121/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= -golang.org/x/sys v0.0.0-20200803210538-64077c9b5642/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= -golang.org/x/sys v0.0.0-20200905004654-be1d3432aa8f/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= -golang.org/x/sys v0.0.0-20200930185726-fdedc70b468f/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= -golang.org/x/sys v0.0.0-20201119102817-f84b799fce68/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= -golang.org/x/sys v0.0.0-20201201145000-ef89a241ccb3/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= -golang.org/x/sys v0.0.0-20210104204734-6f8348627aad/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= -golang.org/x/sys v0.0.0-20210119212857-b64e53b001e4/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= -golang.org/x/sys v0.0.0-20210225134936-a50acf3fe073/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= -golang.org/x/sys v0.0.0-20210423082822-04245dca01da/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= -golang.org/x/sys v0.0.0-20210423185535-09eb48e85fd7/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= -golang.org/x/sys v0.0.0-20210615035016-665e8c7367d1/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= -golang.org/x/sys v0.0.0-20210630005230-0f9fa26af87c/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= -golang.org/x/sys v0.0.0-20210927094055-39ccf1dd6fa6/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= -golang.org/x/sys v0.0.0-20211103235746-7861aae1554b/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= +go.uber.org/multierr v1.11.0 h1:blXXJkSxSSfBVBlC76pxqeO+LN3aDfLQo+309xJstO0= +go.uber.org/multierr v1.11.0/go.mod h1:20+QtiLqy0Nd6FdQB9TLXag12DsQkrbs3htMFfDN80Y= +golang.org/x/crypto v0.19.0 h1:ENy+Az/9Y1vSrlrvBSyna3PITt4tiZLf7sgCjZBX7Wo= +golang.org/x/crypto v0.19.0/go.mod h1:Iy9bg/ha4yyC70EfRS8jz+B6ybOBKMaSxLj6P6oBDfU= +golang.org/x/exp v0.0.0-20240213143201-ec583247a57a h1:HinSgX1tJRX3KsL//Gxynpw5CTOAIPhgL4W8PNiIpVE= +golang.org/x/exp v0.0.0-20240213143201-ec583247a57a/go.mod h1:CxmFvTBINI24O/j8iY7H1xHzx2i4OsyguNBmN/uPtqc= +golang.org/x/net v0.21.0 h1:AQyQV4dYCvJ7vGmJyKki9+PBdyvhkSd8EIx/qb0AYv4= +golang.org/x/net v0.21.0/go.mod h1:bIjVDfnllIU7BJ2DNgfnXvpSvtn8VRwhlsaeUTyUS44= golang.org/x/sys v0.0.0-20220811171246-fbc7d0a398ab/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= -golang.org/x/sys v0.0.0-20220908164124-27713097b956/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= golang.org/x/sys v0.6.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= -golang.org/x/sys v0.10.0 h1:SqMFp9UcQJZa+pmYuAKjd9xq1f0j5rLcDIk0mj4qAsA= -golang.org/x/sys v0.10.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= -golang.org/x/term v0.0.0-20201126162022-7de9c90e9dd1/go.mod h1:bj7SfCRtBDWHUb9snDiAeCFNEtKQo2Wmx5Cou7ajbmo= -golang.org/x/text v0.0.0-20170915032832-14c0d48ead0c/go.mod h1:NqM8EUOU14njkJ3fqMW+pc6Ldnwhi/IjpwHt7yyuwOQ= -golang.org/x/text v0.3.0/go.mod h1:NqM8EUOU14njkJ3fqMW+pc6Ldnwhi/IjpwHt7yyuwOQ= -golang.org/x/text v0.3.1-0.20180807135948-17ff2d5776d2/go.mod h1:NqM8EUOU14njkJ3fqMW+pc6Ldnwhi/IjpwHt7yyuwOQ= -golang.org/x/text v0.3.2/go.mod h1:bEr9sfX3Q8Zfm5fL9x+3itogRgK3+ptLWKqgva+5dAk= -golang.org/x/text v0.3.3/go.mod h1:5Zoc/QRtKVWzQhOtBMvqHzDpF6irO9z98xDceosuGiQ= -golang.org/x/text v0.3.4/go.mod h1:5Zoc/QRtKVWzQhOtBMvqHzDpF6irO9z98xDceosuGiQ= -golang.org/x/text v0.3.6/go.mod h1:5Zoc/QRtKVWzQhOtBMvqHzDpF6irO9z98xDceosuGiQ= -golang.org/x/text v0.3.7/go.mod h1:u+2+/6zg+i71rQMx5EYifcz6MCKuco9NR6JIITiCfzQ= -golang.org/x/text v0.11.0 h1:LAntKIrcmeSKERyiOh0XMV39LXS8IE9UL2yP7+f5ij4= -golang.org/x/text v0.11.0/go.mod h1:TvPlkZtksWOMsz7fbANvkp4WM8x/WCo/om8BMLbz+aE= -golang.org/x/time v0.0.0-20181108054448-85acf8d2951c/go.mod h1:tRJNPiyCQ0inRvYxbN9jk5I+vvW/OXSQhTDSoE431IQ= -golang.org/x/time v0.0.0-20190308202827-9d24e82272b4/go.mod h1:tRJNPiyCQ0inRvYxbN9jk5I+vvW/OXSQhTDSoE431IQ= -golang.org/x/time v0.0.0-20191024005414-555d28b269f0/go.mod h1:tRJNPiyCQ0inRvYxbN9jk5I+vvW/OXSQhTDSoE431IQ= -golang.org/x/time v0.3.0 h1:rg5rLMjNzMS1RkNLzCG38eapWhnYLFYXDXj2gOlr8j4= -golang.org/x/time v0.3.0/go.mod h1:tRJNPiyCQ0inRvYxbN9jk5I+vvW/OXSQhTDSoE431IQ= -golang.org/x/tools v0.0.0-20180917221912-90fa682c2a6e/go.mod h1:n7NCudcB/nEzxVGmLbDWY5pfWTLqBcC2KZ6jyYvM4mQ= -golang.org/x/tools v0.0.0-20190114222345-bf090417da8b/go.mod h1:n7NCudcB/nEzxVGmLbDWY5pfWTLqBcC2KZ6jyYvM4mQ= -golang.org/x/tools v0.0.0-20190226205152-f727befe758c/go.mod h1:9Yl7xja0Znq3iFh3HoIrodX9oNMXvdceNzlUR8zjMvY= -golang.org/x/tools v0.0.0-20190311212946-11955173bddd/go.mod h1:LCzVGOaR6xXOjkQ3onu1FJEFr0SW1gC7cKk1uF8kGRs= -golang.org/x/tools v0.0.0-20190312151545-0bb0c0a6e846/go.mod h1:LCzVGOaR6xXOjkQ3onu1FJEFr0SW1gC7cKk1uF8kGRs= -golang.org/x/tools v0.0.0-20190312170243-e65039ee4138/go.mod h1:LCzVGOaR6xXOjkQ3onu1FJEFr0SW1gC7cKk1uF8kGRs= -golang.org/x/tools v0.0.0-20190425150028-36563e24a262/go.mod h1:RgjU9mgBXZiqYHBnxXauZ1Gv1EHHAz9KjViQ78xBX0Q= -golang.org/x/tools v0.0.0-20190506145303-2d16b83fe98c/go.mod h1:RgjU9mgBXZiqYHBnxXauZ1Gv1EHHAz9KjViQ78xBX0Q= -golang.org/x/tools v0.0.0-20190524140312-2c0ae7006135/go.mod h1:RgjU9mgBXZiqYHBnxXauZ1Gv1EHHAz9KjViQ78xBX0Q= -golang.org/x/tools v0.0.0-20190606124116-d0a3d012864b/go.mod h1:/rFqwRUd4F7ZHNgwSSTFct+R/Kf4OFW1sUzUTQQTgfc= -golang.org/x/tools v0.0.0-20190621195816-6e04913cbbac/go.mod h1:/rFqwRUd4F7ZHNgwSSTFct+R/Kf4OFW1sUzUTQQTgfc= -golang.org/x/tools v0.0.0-20190628153133-6cdbf07be9d0/go.mod h1:/rFqwRUd4F7ZHNgwSSTFct+R/Kf4OFW1sUzUTQQTgfc= -golang.org/x/tools v0.0.0-20190816200558-6889da9d5479/go.mod h1:b+2E5dAYhXwXZwtnZ6UAqBI28+e2cm9otk0dWdXHAEo= -golang.org/x/tools v0.0.0-20190911174233-4f2ddba30aff/go.mod h1:b+2E5dAYhXwXZwtnZ6UAqBI28+e2cm9otk0dWdXHAEo= -golang.org/x/tools v0.0.0-20191012152004-8de300cfc20a/go.mod h1:b+2E5dAYhXwXZwtnZ6UAqBI28+e2cm9otk0dWdXHAEo= -golang.org/x/tools v0.0.0-20191113191852-77e3bb0ad9e7/go.mod h1:b+2E5dAYhXwXZwtnZ6UAqBI28+e2cm9otk0dWdXHAEo= -golang.org/x/tools v0.0.0-20191115202509-3a792d9c32b2/go.mod h1:b+2E5dAYhXwXZwtnZ6UAqBI28+e2cm9otk0dWdXHAEo= -golang.org/x/tools v0.0.0-20191119224855-298f0cb1881e/go.mod h1:b+2E5dAYhXwXZwtnZ6UAqBI28+e2cm9otk0dWdXHAEo= -golang.org/x/tools v0.0.0-20191125144606-a911d9008d1f/go.mod h1:b+2E5dAYhXwXZwtnZ6UAqBI28+e2cm9otk0dWdXHAEo= -golang.org/x/tools v0.0.0-20191130070609-6e064ea0cf2d/go.mod h1:b+2E5dAYhXwXZwtnZ6UAqBI28+e2cm9otk0dWdXHAEo= -golang.org/x/tools v0.0.0-20191216173652-a0e659d51361/go.mod h1:TB2adYChydJhpapKDTa4BR/hXlZSLoq2Wpct/0txZ28= -golang.org/x/tools v0.0.0-20191227053925-7b8e75db28f4/go.mod h1:TB2adYChydJhpapKDTa4BR/hXlZSLoq2Wpct/0txZ28= -golang.org/x/tools v0.0.0-20200117161641-43d50277825c/go.mod h1:TB2adYChydJhpapKDTa4BR/hXlZSLoq2Wpct/0txZ28= -golang.org/x/tools v0.0.0-20200122220014-bf1340f18c4a/go.mod h1:TB2adYChydJhpapKDTa4BR/hXlZSLoq2Wpct/0txZ28= -golang.org/x/tools v0.0.0-20200130002326-2f3ba24bd6e7/go.mod h1:TB2adYChydJhpapKDTa4BR/hXlZSLoq2Wpct/0txZ28= -golang.org/x/tools v0.0.0-20200204074204-1cc6d1ef6c74/go.mod h1:TB2adYChydJhpapKDTa4BR/hXlZSLoq2Wpct/0txZ28= -golang.org/x/tools v0.0.0-20200207183749-b753a1ba74fa/go.mod h1:TB2adYChydJhpapKDTa4BR/hXlZSLoq2Wpct/0txZ28= -golang.org/x/tools v0.0.0-20200212150539-ea181f53ac56/go.mod h1:TB2adYChydJhpapKDTa4BR/hXlZSLoq2Wpct/0txZ28= -golang.org/x/tools v0.0.0-20200224181240-023911ca70b2/go.mod h1:TB2adYChydJhpapKDTa4BR/hXlZSLoq2Wpct/0txZ28= -golang.org/x/tools v0.0.0-20200227222343-706bc42d1f0d/go.mod h1:TB2adYChydJhpapKDTa4BR/hXlZSLoq2Wpct/0txZ28= -golang.org/x/tools v0.0.0-20200304193943-95d2e580d8eb/go.mod h1:o4KQGtdN14AW+yjsvvwRTJJuXz8XRtIHtEnmAXLyFUw= -golang.org/x/tools v0.0.0-20200312045724-11d5b4c81c7d/go.mod h1:o4KQGtdN14AW+yjsvvwRTJJuXz8XRtIHtEnmAXLyFUw= -golang.org/x/tools v0.0.0-20200331025713-a30bf2db82d4/go.mod h1:Sl4aGygMT6LrqrWclx+PTx3U+LnKx/seiNR+3G19Ar8= -golang.org/x/tools v0.0.0-20200501065659-ab2804fb9c9d/go.mod h1:EkVYQZoAsY45+roYkvgYkIh4xh/qjgUK9TdY2XT94GE= -golang.org/x/tools v0.0.0-20200512131952-2bc93b1c0c88/go.mod h1:EkVYQZoAsY45+roYkvgYkIh4xh/qjgUK9TdY2XT94GE= -golang.org/x/tools v0.0.0-20200515010526-7d3b6ebf133d/go.mod h1:EkVYQZoAsY45+roYkvgYkIh4xh/qjgUK9TdY2XT94GE= -golang.org/x/tools v0.0.0-20200618134242-20370b0cb4b2/go.mod h1:EkVYQZoAsY45+roYkvgYkIh4xh/qjgUK9TdY2XT94GE= -golang.org/x/tools v0.0.0-20200729194436-6467de6f59a7/go.mod h1:njjCfa9FT2d7l9Bc6FUM5FLjQPp3cFF28FI3qnDFljA= -golang.org/x/tools v0.0.0-20200804011535-6c149bb5ef0d/go.mod h1:njjCfa9FT2d7l9Bc6FUM5FLjQPp3cFF28FI3qnDFljA= -golang.org/x/tools v0.0.0-20200825202427-b303f430e36d/go.mod h1:njjCfa9FT2d7l9Bc6FUM5FLjQPp3cFF28FI3qnDFljA= -golang.org/x/tools v0.0.0-20200904185747-39188db58858/go.mod h1:Cj7w3i3Rnn0Xh82ur9kSqwfTHTeVxaDqrfMjpcNT6bE= -golang.org/x/tools v0.0.0-20201110124207-079ba7bd75cd/go.mod h1:emZCQorbCU4vsT4fOWvOPXz4eW1wZW4PmDk9uLelYpA= -golang.org/x/tools v0.0.0-20201201161351-ac6f37ff4c2a/go.mod h1:emZCQorbCU4vsT4fOWvOPXz4eW1wZW4PmDk9uLelYpA= -golang.org/x/tools v0.0.0-20201208233053-a543418bbed2/go.mod h1:emZCQorbCU4vsT4fOWvOPXz4eW1wZW4PmDk9uLelYpA= -golang.org/x/tools v0.0.0-20210105154028-b0ab187a4818/go.mod h1:emZCQorbCU4vsT4fOWvOPXz4eW1wZW4PmDk9uLelYpA= -golang.org/x/tools v0.0.0-20210108195828-e2f9c7f1fc8e/go.mod h1:emZCQorbCU4vsT4fOWvOPXz4eW1wZW4PmDk9uLelYpA= -golang.org/x/tools v0.1.0/go.mod h1:xkSsbof2nBLbhDlRMhhhyNLN/zl3eTqcnHD5viDpcZ0= -golang.org/x/xerrors v0.0.0-20190717185122-a985d3407aa7/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0= -golang.org/x/xerrors v0.0.0-20191011141410-1b5146add898/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0= -golang.org/x/xerrors v0.0.0-20191204190536-9bdfabe68543/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0= -golang.org/x/xerrors v0.0.0-20200804184101-5ec99f83aff1/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0= -google.golang.org/api v0.4.0/go.mod h1:8k5glujaEP+g9n7WNsDg8QP6cUVNI86fCNMcbazEtwE= -google.golang.org/api v0.7.0/go.mod h1:WtwebWUNSVBH/HAw79HIFXZNqEvBhG+Ra+ax0hx3E3M= -google.golang.org/api v0.8.0/go.mod h1:o4eAsZoiT+ibD93RtjEohWalFOjRDx6CVaqeizhEnKg= -google.golang.org/api v0.9.0/go.mod h1:o4eAsZoiT+ibD93RtjEohWalFOjRDx6CVaqeizhEnKg= -google.golang.org/api v0.13.0/go.mod h1:iLdEw5Ide6rF15KTC1Kkl0iskquN2gFfn9o9XIsbkAI= -google.golang.org/api v0.14.0/go.mod h1:iLdEw5Ide6rF15KTC1Kkl0iskquN2gFfn9o9XIsbkAI= -google.golang.org/api v0.15.0/go.mod h1:iLdEw5Ide6rF15KTC1Kkl0iskquN2gFfn9o9XIsbkAI= -google.golang.org/api v0.17.0/go.mod h1:BwFmGc8tA3vsd7r/7kR8DY7iEEGSU04BFxCo5jP/sfE= -google.golang.org/api v0.18.0/go.mod h1:BwFmGc8tA3vsd7r/7kR8DY7iEEGSU04BFxCo5jP/sfE= -google.golang.org/api v0.19.0/go.mod h1:BwFmGc8tA3vsd7r/7kR8DY7iEEGSU04BFxCo5jP/sfE= -google.golang.org/api v0.20.0/go.mod h1:BwFmGc8tA3vsd7r/7kR8DY7iEEGSU04BFxCo5jP/sfE= -google.golang.org/api v0.22.0/go.mod h1:BwFmGc8tA3vsd7r/7kR8DY7iEEGSU04BFxCo5jP/sfE= -google.golang.org/api v0.24.0/go.mod h1:lIXQywCXRcnZPGlsd8NbLnOjtAoL6em04bJ9+z0MncE= -google.golang.org/api v0.28.0/go.mod h1:lIXQywCXRcnZPGlsd8NbLnOjtAoL6em04bJ9+z0MncE= -google.golang.org/api v0.29.0/go.mod h1:Lcubydp8VUV7KeIHD9z2Bys/sm/vGKnG1UHuDBSrHWM= -google.golang.org/api v0.30.0/go.mod h1:QGmEvQ87FHZNiUVJkT14jQNYJ4ZJjdRF23ZXz5138Fc= -google.golang.org/api v0.35.0/go.mod h1:/XrVsuzM0rZmrsbjJutiuftIzeuTQcEeaYcSk/mQ1dg= -google.golang.org/api v0.36.0/go.mod h1:+z5ficQTmoYpPn8LCUNVpK5I7hwkpjbcgqA7I34qYtE= -google.golang.org/api v0.40.0/go.mod h1:fYKFpnQN0DsDSKRVRcQSDQNtqWPfM9i+zNPxepjRCQ8= -google.golang.org/appengine v1.1.0/go.mod h1:EbEs0AVv82hx2wNQdGPgUI5lhzA/G0D9YwlJXL52JkM= -google.golang.org/appengine v1.4.0/go.mod h1:xpcJRLb0r/rnEns0DIKYYv+WjYCduHsrkT7/EB5XEv4= -google.golang.org/appengine v1.5.0/go.mod h1:xpcJRLb0r/rnEns0DIKYYv+WjYCduHsrkT7/EB5XEv4= -google.golang.org/appengine v1.6.1/go.mod h1:i06prIuMbXzDqacNJfV5OdTW448YApPu5ww/cMBSeb0= -google.golang.org/appengine v1.6.5/go.mod h1:8WjMMxjGQR8xUklV/ARdw2HLXBOI7O7uCIDZVag1xfc= -google.golang.org/appengine v1.6.6/go.mod h1:8WjMMxjGQR8xUklV/ARdw2HLXBOI7O7uCIDZVag1xfc= -google.golang.org/appengine v1.6.7/go.mod h1:8WjMMxjGQR8xUklV/ARdw2HLXBOI7O7uCIDZVag1xfc= -google.golang.org/genproto v0.0.0-20180817151627-c66870c02cf8/go.mod h1:JiN7NxoALGmiZfu7CAH4rXhgtRTLTxftemlI0sWmxmc= -google.golang.org/genproto v0.0.0-20190307195333-5fe7a883aa19/go.mod h1:VzzqZJRnGkLBvHegQrXjBqPurQTc5/KpmUdxsrq26oE= -google.golang.org/genproto v0.0.0-20190418145605-e7d98fc518a7/go.mod h1:VzzqZJRnGkLBvHegQrXjBqPurQTc5/KpmUdxsrq26oE= -google.golang.org/genproto v0.0.0-20190425155659-357c62f0e4bb/go.mod h1:VzzqZJRnGkLBvHegQrXjBqPurQTc5/KpmUdxsrq26oE= -google.golang.org/genproto v0.0.0-20190502173448-54afdca5d873/go.mod h1:VzzqZJRnGkLBvHegQrXjBqPurQTc5/KpmUdxsrq26oE= -google.golang.org/genproto v0.0.0-20190801165951-fa694d86fc64/go.mod h1:DMBHOl98Agz4BDEuKkezgsaosCRResVns1a3J2ZsMNc= -google.golang.org/genproto v0.0.0-20190819201941-24fa4b261c55/go.mod h1:DMBHOl98Agz4BDEuKkezgsaosCRResVns1a3J2ZsMNc= -google.golang.org/genproto v0.0.0-20190911173649-1774047e7e51/go.mod h1:IbNlFCBrqXvoKpeg0TB2l7cyZUmoaFKYIwrEpbDKLA8= -google.golang.org/genproto v0.0.0-20191108220845-16a3f7862a1a/go.mod h1:n3cpQtvxv34hfy77yVDNjmbRyujviMdxYliBSkLhpCc= -google.golang.org/genproto v0.0.0-20191115194625-c23dd37a84c9/go.mod h1:n3cpQtvxv34hfy77yVDNjmbRyujviMdxYliBSkLhpCc= -google.golang.org/genproto v0.0.0-20191216164720-4f79533eabd1/go.mod h1:n3cpQtvxv34hfy77yVDNjmbRyujviMdxYliBSkLhpCc= -google.golang.org/genproto v0.0.0-20191230161307-f3c370f40bfb/go.mod h1:n3cpQtvxv34hfy77yVDNjmbRyujviMdxYliBSkLhpCc= -google.golang.org/genproto v0.0.0-20200115191322-ca5a22157cba/go.mod h1:n3cpQtvxv34hfy77yVDNjmbRyujviMdxYliBSkLhpCc= -google.golang.org/genproto v0.0.0-20200122232147-0452cf42e150/go.mod h1:n3cpQtvxv34hfy77yVDNjmbRyujviMdxYliBSkLhpCc= -google.golang.org/genproto v0.0.0-20200204135345-fa8e72b47b90/go.mod h1:GmwEX6Z4W5gMy59cAlVYjN9JhxgbQH6Gn+gFDQe2lzA= -google.golang.org/genproto v0.0.0-20200212174721-66ed5ce911ce/go.mod h1:55QSHmfGQM9UVYDPBsyGGes0y52j32PQ3BqQfXhyH3c= -google.golang.org/genproto v0.0.0-20200224152610-e50cd9704f63/go.mod h1:55QSHmfGQM9UVYDPBsyGGes0y52j32PQ3BqQfXhyH3c= -google.golang.org/genproto v0.0.0-20200228133532-8c2c7df3a383/go.mod h1:55QSHmfGQM9UVYDPBsyGGes0y52j32PQ3BqQfXhyH3c= -google.golang.org/genproto v0.0.0-20200305110556-506484158171/go.mod h1:55QSHmfGQM9UVYDPBsyGGes0y52j32PQ3BqQfXhyH3c= -google.golang.org/genproto v0.0.0-20200312145019-da6875a35672/go.mod h1:55QSHmfGQM9UVYDPBsyGGes0y52j32PQ3BqQfXhyH3c= -google.golang.org/genproto v0.0.0-20200331122359-1ee6d9798940/go.mod h1:55QSHmfGQM9UVYDPBsyGGes0y52j32PQ3BqQfXhyH3c= -google.golang.org/genproto v0.0.0-20200430143042-b979b6f78d84/go.mod h1:55QSHmfGQM9UVYDPBsyGGes0y52j32PQ3BqQfXhyH3c= -google.golang.org/genproto v0.0.0-20200511104702-f5ebc3bea380/go.mod h1:55QSHmfGQM9UVYDPBsyGGes0y52j32PQ3BqQfXhyH3c= -google.golang.org/genproto v0.0.0-20200515170657-fc4c6c6a6587/go.mod h1:YsZOwe1myG/8QRHRsmBRE1LrgQY60beZKjly0O1fX9U= -google.golang.org/genproto v0.0.0-20200526211855-cb27e3aa2013/go.mod h1:NbSheEEYHJ7i3ixzK3sjbqSGDJWnxyFXZblF3eUsNvo= -google.golang.org/genproto v0.0.0-20200618031413-b414f8b61790/go.mod h1:jDfRM7FcilCzHH/e9qn6dsT145K34l5v+OpcnNgKAAA= -google.golang.org/genproto v0.0.0-20200729003335-053ba62fc06f/go.mod h1:FWY/as6DDZQgahTzZj3fqbO1CbirC29ZNUFHwi0/+no= -google.golang.org/genproto v0.0.0-20200804131852-c06518451d9c/go.mod h1:FWY/as6DDZQgahTzZj3fqbO1CbirC29ZNUFHwi0/+no= -google.golang.org/genproto v0.0.0-20200825200019-8632dd797987/go.mod h1:FWY/as6DDZQgahTzZj3fqbO1CbirC29ZNUFHwi0/+no= -google.golang.org/genproto v0.0.0-20200904004341-0bd0a958aa1d/go.mod h1:FWY/as6DDZQgahTzZj3fqbO1CbirC29ZNUFHwi0/+no= -google.golang.org/genproto v0.0.0-20201109203340-2640f1f9cdfb/go.mod h1:FWY/as6DDZQgahTzZj3fqbO1CbirC29ZNUFHwi0/+no= -google.golang.org/genproto v0.0.0-20201201144952-b05cb90ed32e/go.mod h1:FWY/as6DDZQgahTzZj3fqbO1CbirC29ZNUFHwi0/+no= -google.golang.org/genproto v0.0.0-20201210142538-e3217bee35cc/go.mod h1:FWY/as6DDZQgahTzZj3fqbO1CbirC29ZNUFHwi0/+no= -google.golang.org/genproto v0.0.0-20201214200347-8c77b98c765d/go.mod h1:FWY/as6DDZQgahTzZj3fqbO1CbirC29ZNUFHwi0/+no= -google.golang.org/genproto v0.0.0-20210108203827-ffc7fda8c3d7/go.mod h1:FWY/as6DDZQgahTzZj3fqbO1CbirC29ZNUFHwi0/+no= -google.golang.org/genproto v0.0.0-20210226172003-ab064af71705/go.mod h1:FWY/as6DDZQgahTzZj3fqbO1CbirC29ZNUFHwi0/+no= -google.golang.org/grpc v1.19.0/go.mod h1:mqu4LbDTu4XGKhr4mRzUsmM4RtVoemTSY81AxZiDr8c= -google.golang.org/grpc v1.20.1/go.mod h1:10oTOabMzJvdu6/UiuZezV6QK5dSlG84ov/aaiqXj38= -google.golang.org/grpc v1.21.1/go.mod h1:oYelfM1adQP15Ek0mdvEgi9Df8B9CZIaU1084ijfRaM= -google.golang.org/grpc v1.23.0/go.mod h1:Y5yQAOtifL1yxbo5wqy6BxZv8vAUGQwXBOALyacEbxg= -google.golang.org/grpc v1.25.1/go.mod h1:c3i+UQWmh7LiEpx4sFZnkU36qjEYZ0imhYfXVyQciAY= -google.golang.org/grpc v1.26.0/go.mod h1:qbnxyOmOxrQa7FizSgH+ReBfzJrCY1pSN7KXBS8abTk= -google.golang.org/grpc v1.27.0/go.mod h1:qbnxyOmOxrQa7FizSgH+ReBfzJrCY1pSN7KXBS8abTk= -google.golang.org/grpc v1.27.1/go.mod h1:qbnxyOmOxrQa7FizSgH+ReBfzJrCY1pSN7KXBS8abTk= -google.golang.org/grpc v1.28.0/go.mod h1:rpkK4SK4GF4Ach/+MFLZUBavHOvF2JJB5uozKKal+60= -google.golang.org/grpc v1.29.1/go.mod h1:itym6AZVZYACWQqET3MqgPpjcuV5QH3BxFS3IjizoKk= -google.golang.org/grpc v1.30.0/go.mod h1:N36X2cJ7JwdamYAgDz+s+rVMFjt3numwzf/HckM8pak= -google.golang.org/grpc v1.31.0/go.mod h1:N36X2cJ7JwdamYAgDz+s+rVMFjt3numwzf/HckM8pak= -google.golang.org/grpc v1.31.1/go.mod h1:N36X2cJ7JwdamYAgDz+s+rVMFjt3numwzf/HckM8pak= -google.golang.org/grpc v1.33.2/go.mod h1:JMHMWHQWaTccqQQlmk3MJZS+GWXOdAesneDmEnv2fbc= -google.golang.org/grpc v1.34.0/go.mod h1:WotjhfgOW/POjDeRt8vscBtXq+2VjORFy659qA51WJ8= -google.golang.org/grpc v1.35.0/go.mod h1:qjiiYl8FncCW8feJPdyg3v6XW24KsRHe+dy9BAGRRjU= -google.golang.org/protobuf v0.0.0-20200109180630-ec00e32a8dfd/go.mod h1:DFci5gLYBciE7Vtevhsrf46CRTquxDuWsQurQQe4oz8= -google.golang.org/protobuf v0.0.0-20200221191635-4d8936d0db64/go.mod h1:kwYJMbMJ01Woi6D6+Kah6886xMZcty6N08ah7+eCXa0= -google.golang.org/protobuf v0.0.0-20200228230310-ab0ca4ff8a60/go.mod h1:cfTl7dwQJ+fmap5saPgwCLgHXTUD7jkjRqWcaiX5VyM= -google.golang.org/protobuf v1.20.1-0.20200309200217-e05f789c0967/go.mod h1:A+miEFZTKqfCUM6K7xSMQL9OKL/b6hQv+e19PK+JZNE= -google.golang.org/protobuf v1.21.0/go.mod h1:47Nbq4nVaFHyn7ilMalzfO3qCViNmqZ2kzikPIcrTAo= -google.golang.org/protobuf v1.22.0/go.mod h1:EGpADcykh3NcUnDUJcl1+ZksZNG86OlYog2l/sGQquU= -google.golang.org/protobuf v1.23.0/go.mod h1:EGpADcykh3NcUnDUJcl1+ZksZNG86OlYog2l/sGQquU= -google.golang.org/protobuf v1.23.1-0.20200526195155-81db48ad09cc/go.mod h1:EGpADcykh3NcUnDUJcl1+ZksZNG86OlYog2l/sGQquU= -google.golang.org/protobuf v1.24.0/go.mod h1:r/3tXBNzIEhYS9I1OUVjXDlt8tc493IdKGjtUeSXeh4= -google.golang.org/protobuf v1.25.0/go.mod h1:9JNX74DMeImyA3h4bdi1ymwjUzf21/xIlbajtzgsN7c= +golang.org/x/sys v0.17.0 h1:25cE3gD+tdBA7lp7QfhuV+rJiE9YXTcS3VG1SqssI/Y= +golang.org/x/sys v0.17.0/go.mod h1:/VUhepiaJMQUp4+oa/7Zr1D23ma6VTLIYjOOTFZPUcA= +golang.org/x/text v0.14.0 h1:ScX5w1eTa3QqT8oi6+ziP7dTV1S2+ALU0bI+0zXKWiQ= +golang.org/x/text v0.14.0/go.mod h1:18ZOQIKpY8NJVqYksKHtTdi31H5itFRjB5/qKTNYzSU= +golang.org/x/time v0.5.0 h1:o7cqy6amK/52YcAKIPlM3a+Fpj35zvRj2TP+e1xFSfk= +golang.org/x/time v0.5.0/go.mod h1:3BpzKBy/shNhVucY/MWOyx10tF3SFh9QdLuxbVysPQM= gopkg.in/check.v1 v0.0.0-20161208181325-20d25e280405/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0= -gopkg.in/check.v1 v1.0.0-20180628173108-788fd7840127 h1:qIbj1fsPNlZgppZ+VLlY7N33q108Sa+fhmuc+sWQYwY= -gopkg.in/check.v1 v1.0.0-20180628173108-788fd7840127/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0= -gopkg.in/errgo.v2 v2.1.0/go.mod h1:hNsd1EY+bozCKY1Ytp96fpM3vjJbqLJn88ws8XvfDNI= +gopkg.in/check.v1 v1.0.0-20190902080502-41f04d3bba15 h1:YR8cESwS4TdDjEe65xsg0ogRM/Nc3DYOhEAlW+xobZo= +gopkg.in/check.v1 v1.0.0-20190902080502-41f04d3bba15/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0= gopkg.in/ini.v1 v1.67.0 h1:Dgnx+6+nfE+IfzjUEISNeydPJh9AXNNsWbGP9KzCsOA= gopkg.in/ini.v1 v1.67.0/go.mod h1:pNLf8WUiyNEtQjuu5G5vTm06TEv9tsIgeAvK8hOrP4k= -gopkg.in/yaml.v2 v2.2.2/go.mod h1:hI93XBmqTisBFMUTm0b8Fm+jr3Dg1NNxqwp+5A1VGuI= gopkg.in/yaml.v3 v3.0.0-20200313102051-9f266ea9e77c/go.mod h1:K4uyk7z7BCEPqu6E+C64Yfv1cQ7kz7rIZviUmN+EgEM= -gopkg.in/yaml.v3 v3.0.0-20210107192922-496545a6307b/go.mod h1:K4uyk7z7BCEPqu6E+C64Yfv1cQ7kz7rIZviUmN+EgEM= gopkg.in/yaml.v3 v3.0.1 h1:fxVm/GzAzEWqLHuvctI91KS9hhNmmWOoWu0XTYJS7CA= gopkg.in/yaml.v3 v3.0.1/go.mod h1:K4uyk7z7BCEPqu6E+C64Yfv1cQ7kz7rIZviUmN+EgEM= -honnef.co/go/tools v0.0.0-20190102054323-c2f93a96b099/go.mod h1:rf3lG4BRIbNafJWhAfAdb/ePZxsR/4RtNHQocxwk9r4= -honnef.co/go/tools v0.0.0-20190106161140-3f1c8253044a/go.mod h1:rf3lG4BRIbNafJWhAfAdb/ePZxsR/4RtNHQocxwk9r4= -honnef.co/go/tools v0.0.0-20190418001031-e561f6794a2a/go.mod h1:rf3lG4BRIbNafJWhAfAdb/ePZxsR/4RtNHQocxwk9r4= -honnef.co/go/tools v0.0.0-20190523083050-ea95bdfd59fc/go.mod h1:rf3lG4BRIbNafJWhAfAdb/ePZxsR/4RtNHQocxwk9r4= -honnef.co/go/tools v0.0.1-2019.2.3/go.mod h1:a3bituU0lyd329TUQxRnasdCoJDkEUEAqEt0JzvZhAg= -honnef.co/go/tools v0.0.1-2020.1.3/go.mod h1:X/FiERA/W4tHapMX5mGpAtMSVEeEUOyHaw9vFzvIQ3k= -honnef.co/go/tools v0.0.1-2020.1.4/go.mod h1:X/FiERA/W4tHapMX5mGpAtMSVEeEUOyHaw9vFzvIQ3k= -rsc.io/binaryregexp v0.2.0/go.mod h1:qTv7/COck+e2FymRvadv62gMdZztPaShugOCi3I+8D8= -rsc.io/quote/v3 v3.1.0/go.mod h1:yEA65RcK8LyAZtP9Kv3t0HmxON59tX3rD+tICJqUlj0= -rsc.io/sampler v1.3.0/go.mod h1:T1hPZKmBbMNahiBKFy5HrXp6adAjACjK9JXDnKaTXpA= From 4d8ae6782b49a59b32d0993017d68b869e788824 Mon Sep 17 00:00:00 2001 From: Victor Lacasse-Beaudoin Date: Wed, 14 Feb 2024 16:53:59 -0500 Subject: [PATCH 53/55] =?UTF-8?q?fix:=20ajouter=20client=20http=20=C3=A0?= =?UTF-8?q?=20`bottinClient`?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Requis par version 6 du API client --- cmd/api.go | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-) diff --git a/cmd/api.go b/cmd/api.go index fa70ab6..62d96cc 100644 --- a/cmd/api.go +++ b/cmd/api.go @@ -7,6 +7,7 @@ import ( "crypto/subtle" "fmt" "log" + "net/http" "git.agecem.com/agecem/bottin-ag/apihandler" "git.agecem.com/agecem/bottin-ag/config" @@ -40,7 +41,15 @@ var apiCmd = &cobra.Command{ v0 := e.Group("/v0") - bottinApiClient := bottindata.NewApiClient(cfg.Bottin.API.Key, cfg.Bottin.API.Host, cfg.Bottin.API.Protocol, cfg.Bottin.API.Port) + httpClient := http.DefaultClient + + bottinApiClient := bottindata.NewApiClient( + httpClient, + cfg.Bottin.API.Key, + cfg.Bottin.API.Host, + cfg.Bottin.API.Protocol, + cfg.Bottin.API.Port, + ) dbClient, err := dbclient.New(cfg.DB.Host, cfg.DB.Database, cfg.DB.User, cfg.DB.Password, cfg.DB.Port, cfg.DB.UseSSL) if err != nil { From fcaa14ee9a000725168f0ce99db8d59ee905b885 Mon Sep 17 00:00:00 2001 From: Victor Lacasse-Beaudoin Date: Wed, 14 Feb 2024 17:03:24 -0500 Subject: [PATCH 54/55] =?UTF-8?q?fix:=20reconsid=C3=A9rer=20`Not=20Found`?= =?UTF-8?q?=20sur=20`GetMembre`=20comme=20non-trouv=C3=A9?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- apihandler/apihandler.go | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/apihandler/apihandler.go b/apihandler/apihandler.go index fe10e77..e7363d4 100644 --- a/apihandler/apihandler.go +++ b/apihandler/apihandler.go @@ -81,7 +81,7 @@ func (a *APIHandler) ScanGET(c echo.Context) error { membre, err := a.BottinAPIClient.GetMembre(membreID) if err != nil { switch err.Error() { - case "Ce numéro étudiant ne correspond à aucunE membre": + case "Ce numéro étudiant ne correspond à aucunE membre", "Not Found": r.Message = fmt.Sprintf("%s n'est pas membre de l'AGECEM", membreID) r.StatusCode = http.StatusNotFound case "Veuillez fournir un numéro étudiant à rechercher": @@ -115,7 +115,7 @@ func (a *APIHandler) ScanPOST(c echo.Context) error { membre, err := a.BottinAPIClient.GetMembre(membreID) if err != nil { switch err.Error() { - case "Ce numéro étudiant ne correspond à aucunE membre": + case "Ce numéro étudiant ne correspond à aucunE membre", "Not Found": r.Message = fmt.Sprintf("👎 %s n'est pas membre de l'AGECEM", membreID) r.Error = err.Error() r.StatusCode = http.StatusNotFound From 4220663bf8ede5f1bb030f22e087c2c446a6cc9a Mon Sep 17 00:00:00 2001 From: Victor Lacasse-Beaudoin Date: Mon, 19 Feb 2024 12:23:30 -0500 Subject: [PATCH 55/55] license: remplacer `MIT` par `GPL-2.0` --- LICENSE | 119 +++++++++++++++++++++++++++++++++++++++++++++++++++++--- 1 file changed, 114 insertions(+), 5 deletions(-) diff --git a/LICENSE b/LICENSE index f166f48..7d6e2c2 100644 --- a/LICENSE +++ b/LICENSE @@ -1,9 +1,118 @@ -MIT License +GNU GENERAL PUBLIC LICENSE +Version 2, June 1991 -Copyright (c) 2023 AGECEM +Copyright (C) 1989, 1991 Free Software Foundation, Inc. +51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA -Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions: +Everyone is permitted to copy and distribute verbatim copies of this license document, but changing it is not allowed. -The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. +Preamble + +The licenses for most software are designed to take away your freedom to share and change it. By contrast, the GNU General Public License is intended to guarantee your freedom to share and change free software--to make sure the software is free for all its users. This General Public License applies to most of the Free Software Foundation's software and to any other program whose authors commit to using it. (Some other Free Software Foundation software is covered by the GNU Lesser General Public License instead.) You can apply it to your programs, too. + +When we speak of free software, we are referring to freedom, not price. Our General Public Licenses are designed to make sure that you have the freedom to distribute copies of free software (and charge for this service if you wish), that you receive source code or can get it if you want it, that you can change the software or use pieces of it in new free programs; and that you know you can do these things. + +To protect your rights, we need to make restrictions that forbid anyone to deny you these rights or to ask you to surrender the rights. These restrictions translate to certain responsibilities for you if you distribute copies of the software, or if you modify it. + +For example, if you distribute copies of such a program, whether gratis or for a fee, you must give the recipients all the rights that you have. You must make sure that they, too, receive or can get the source code. And you must show them these terms so they know their rights. + +We protect your rights with two steps: (1) copyright the software, and (2) offer you this license which gives you legal permission to copy, distribute and/or modify the software. + +Also, for each author's protection and ours, we want to make certain that everyone understands that there is no warranty for this free software. If the software is modified by someone else and passed on, we want its recipients to know that what they have is not the original, so that any problems introduced by others will not reflect on the original authors' reputations. + +Finally, any free program is threatened constantly by software patents. We wish to avoid the danger that redistributors of a free program will individually obtain patent licenses, in effect making the program proprietary. To prevent this, we have made it clear that any patent must be licensed for everyone's free use or not licensed at all. + +The precise terms and conditions for copying, distribution and modification follow. + +TERMS AND CONDITIONS FOR COPYING, DISTRIBUTION AND MODIFICATION + +0. This License applies to any program or other work which contains a notice placed by the copyright holder saying it may be distributed under the terms of this General Public License. The "Program", below, refers to any such program or work, and a "work based on the Program" means either the Program or any derivative work under copyright law: that is to say, a work containing the Program or a portion of it, either verbatim or with modifications and/or translated into another language. (Hereinafter, translation is included without limitation in the term "modification".) Each licensee is addressed as "you". + +Activities other than copying, distribution and modification are not covered by this License; they are outside its scope. The act of running the Program is not restricted, and the output from the Program is covered only if its contents constitute a work based on the Program (independent of having been made by running the Program). Whether that is true depends on what the Program does. + +1. You may copy and distribute verbatim copies of the Program's source code as you receive it, in any medium, provided that you conspicuously and appropriately publish on each copy an appropriate copyright notice and disclaimer of warranty; keep intact all the notices that refer to this License and to the absence of any warranty; and give any other recipients of the Program a copy of this License along with the Program. + +You may charge a fee for the physical act of transferring a copy, and you may at your option offer warranty protection in exchange for a fee. + +2. You may modify your copy or copies of the Program or any portion of it, thus forming a work based on the Program, and copy and distribute such modifications or work under the terms of Section 1 above, provided that you also meet all of these conditions: + + a) You must cause the modified files to carry prominent notices stating that you changed the files and the date of any change. + + b) You must cause any work that you distribute or publish, that in whole or in part contains or is derived from the Program or any part thereof, to be licensed as a whole at no charge to all third parties under the terms of this License. + + c) If the modified program normally reads commands interactively when run, you must cause it, when started running for such interactive use in the most ordinary way, to print or display an announcement including an appropriate copyright notice and a notice that there is no warranty (or else, saying that you provide a warranty) and that users may redistribute the program under these conditions, and telling the user how to view a copy of this License. (Exception: if the Program itself is interactive but does not normally print such an announcement, your work based on the Program is not required to print an announcement.) + +These requirements apply to the modified work as a whole. If identifiable sections of that work are not derived from the Program, and can be reasonably considered independent and separate works in themselves, then this License, and its terms, do not apply to those sections when you distribute them as separate works. But when you distribute the same sections as part of a whole which is a work based on the Program, the distribution of the whole must be on the terms of this License, whose permissions for other licensees extend to the entire whole, and thus to each and every part regardless of who wrote it. + +Thus, it is not the intent of this section to claim rights or contest your rights to work written entirely by you; rather, the intent is to exercise the right to control the distribution of derivative or collective works based on the Program. + +In addition, mere aggregation of another work not based on the Program with the Program (or with a work based on the Program) on a volume of a storage or distribution medium does not bring the other work under the scope of this License. + +3. You may copy and distribute the Program (or a work based on it, under Section 2) in object code or executable form under the terms of Sections 1 and 2 above provided that you also do one of the following: + + a) Accompany it with the complete corresponding machine-readable source code, which must be distributed under the terms of Sections 1 and 2 above on a medium customarily used for software interchange; or, + + b) Accompany it with a written offer, valid for at least three years, to give any third party, for a charge no more than your cost of physically performing source distribution, a complete machine-readable copy of the corresponding source code, to be distributed under the terms of Sections 1 and 2 above on a medium customarily used for software interchange; or, + + c) Accompany it with the information you received as to the offer to distribute corresponding source code. (This alternative is allowed only for noncommercial distribution and only if you received the program in object code or executable form with such an offer, in accord with Subsection b above.) + +The source code for a work means the preferred form of the work for making modifications to it. For an executable work, complete source code means all the source code for all modules it contains, plus any associated interface definition files, plus the scripts used to control compilation and installation of the executable. However, as a special exception, the source code distributed need not include anything that is normally distributed (in either source or binary form) with the major components (compiler, kernel, and so on) of the operating system on which the executable runs, unless that component itself accompanies the executable. + +If distribution of executable or object code is made by offering access to copy from a designated place, then offering equivalent access to copy the source code from the same place counts as distribution of the source code, even though third parties are not compelled to copy the source along with the object code. + +4. You may not copy, modify, sublicense, or distribute the Program except as expressly provided under this License. Any attempt otherwise to copy, modify, sublicense or distribute the Program is void, and will automatically terminate your rights under this License. However, parties who have received copies, or rights, from you under this License will not have their licenses terminated so long as such parties remain in full compliance. + +5. You are not required to accept this License, since you have not signed it. However, nothing else grants you permission to modify or distribute the Program or its derivative works. These actions are prohibited by law if you do not accept this License. Therefore, by modifying or distributing the Program (or any work based on the Program), you indicate your acceptance of this License to do so, and all its terms and conditions for copying, distributing or modifying the Program or works based on it. + +6. Each time you redistribute the Program (or any work based on the Program), the recipient automatically receives a license from the original licensor to copy, distribute or modify the Program subject to these terms and conditions. You may not impose any further restrictions on the recipients' exercise of the rights granted herein. You are not responsible for enforcing compliance by third parties to this License. + +7. If, as a consequence of a court judgment or allegation of patent infringement or for any other reason (not limited to patent issues), conditions are imposed on you (whether by court order, agreement or otherwise) that contradict the conditions of this License, they do not excuse you from the conditions of this License. If you cannot distribute so as to satisfy simultaneously your obligations under this License and any other pertinent obligations, then as a consequence you may not distribute the Program at all. For example, if a patent license would not permit royalty-free redistribution of the Program by all those who receive copies directly or indirectly through you, then the only way you could satisfy both it and this License would be to refrain entirely from distribution of the Program. + +If any portion of this section is held invalid or unenforceable under any particular circumstance, the balance of the section is intended to apply and the section as a whole is intended to apply in other circumstances. + +It is not the purpose of this section to induce you to infringe any patents or other property right claims or to contest validity of any such claims; this section has the sole purpose of protecting the integrity of the free software distribution system, which is implemented by public license practices. Many people have made generous contributions to the wide range of software distributed through that system in reliance on consistent application of that system; it is up to the author/donor to decide if he or she is willing to distribute software through any other system and a licensee cannot impose that choice. + +This section is intended to make thoroughly clear what is believed to be a consequence of the rest of this License. + +8. If the distribution and/or use of the Program is restricted in certain countries either by patents or by copyrighted interfaces, the original copyright holder who places the Program under this License may add an explicit geographical distribution limitation excluding those countries, so that distribution is permitted only in or among countries not thus excluded. In such case, this License incorporates the limitation as if written in the body of this License. + +9. The Free Software Foundation may publish revised and/or new versions of the General Public License from time to time. Such new versions will be similar in spirit to the present version, but may differ in detail to address new problems or concerns. + +Each version is given a distinguishing version number. If the Program specifies a version number of this License which applies to it and "any later version", you have the option of following the terms and conditions either of that version or of any later version published by the Free Software Foundation. If the Program does not specify a version number of this License, you may choose any version ever published by the Free Software Foundation. + +10. If you wish to incorporate parts of the Program into other free programs whose distribution conditions are different, write to the author to ask for permission. For software which is copyrighted by the Free Software Foundation, write to the Free Software Foundation; we sometimes make exceptions for this. Our decision will be guided by the two goals of preserving the free status of all derivatives of our free software and of promoting the sharing and reuse of software generally. + +NO WARRANTY + +11. BECAUSE THE PROGRAM IS LICENSED FREE OF CHARGE, THERE IS NO WARRANTY FOR THE PROGRAM, TO THE EXTENT PERMITTED BY APPLICABLE LAW. EXCEPT WHEN OTHERWISE STATED IN WRITING THE COPYRIGHT HOLDERS AND/OR OTHER PARTIES PROVIDE THE PROGRAM "AS IS" WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. THE ENTIRE RISK AS TO THE QUALITY AND PERFORMANCE OF THE PROGRAM IS WITH YOU. SHOULD THE PROGRAM PROVE DEFECTIVE, YOU ASSUME THE COST OF ALL NECESSARY SERVICING, REPAIR OR CORRECTION. + +12. IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN WRITING WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MAY MODIFY AND/OR REDISTRIBUTE THE PROGRAM AS PERMITTED ABOVE, BE LIABLE TO YOU FOR DAMAGES, INCLUDING ANY GENERAL, SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES ARISING OUT OF THE USE OR INABILITY TO USE THE PROGRAM (INCLUDING BUT NOT LIMITED TO LOSS OF DATA OR DATA BEING RENDERED INACCURATE OR LOSSES SUSTAINED BY YOU OR THIRD PARTIES OR A FAILURE OF THE PROGRAM TO OPERATE WITH ANY OTHER PROGRAMS), EVEN IF SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGES. + +END OF TERMS AND CONDITIONS + +How to Apply These Terms to Your New Programs + +If you develop a new program, and you want it to be of the greatest possible use to the public, the best way to achieve this is to make it free software which everyone can redistribute and change under these terms. + +To do so, attach the following notices to the program. It is safest to attach them to the start of each source file to most effectively convey the exclusion of warranty; and each file should have at least the "copyright" line and a pointer to where the full notice is found. + + one line to give the program's name and an idea of what it does. Copyright (C) yyyy name of author + + This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation; either version 2 of the License, or (at your option) any later version. + + This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. + + You should have received a copy of the GNU General Public License along with this program; if not, write to the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. Also add information on how to contact you by electronic and paper mail. + +If the program is interactive, make it output a short notice like this when it starts in an interactive mode: + + Gnomovision version 69, Copyright (C) year name of author Gnomovision comes with ABSOLUTELY NO WARRANTY; for details type `show w'. This is free software, and you are welcome to redistribute it under certain conditions; type `show c' for details. + +The hypothetical commands `show w' and `show c' should show the appropriate parts of the General Public License. Of course, the commands you use may be called something other than `show w' and `show c'; they could even be mouse-clicks or menu items--whatever suits your program. + +You should also get your employer (if you work as a programmer) or your school, if any, to sign a "copyright disclaimer" for the program, if necessary. Here is a sample; alter the names: + + Yoyodyne, Inc., hereby disclaims all copyright interest in the program `Gnomovision' (which makes passes at compilers) written by James Hacker. + +signature of Ty Coon, 1 April 1989 Ty Coon, President of Vice -THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.