Implémenter page web de scan de présence

Voir diff pour détails
This commit is contained in:
Victor Lacasse-Beaudoin 2023-09-17 16:32:40 -04:00
parent c6f3a52f91
commit c218860e33
10 changed files with 139 additions and 10 deletions

View file

@ -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 {