feature(api): permettre d'exposer le serveur API par https

Requiert `cfg.API.TLS.Enabled = true` et des fichiers valides pour
`cfg.API.TLS.{CertificateFile,PrivateKeyFile}`
This commit is contained in:
Victor Lacasse-Beaudoin 2024-07-03 20:51:57 -04:00
parent 150782c42f
commit 4ce3d9f60b

17
cmd.go
View file

@ -114,7 +114,22 @@ var apiCmd = &cobra.Command{
*/ */
// Execution // Execution
e.Logger.Fatal(e.Start(fmt.Sprintf(":%d", cfg.API.Port))) switch cfg.API.TLS.Enabled {
case false:
e.Logger.Fatal(
e.Start(
fmt.Sprintf(":%d", cfg.API.Port),
),
)
case true:
e.Logger.Fatal(
e.StartTLS(
fmt.Sprintf(":%d", cfg.API.Port),
cfg.API.TLS.CertificateFile,
cfg.API.TLS.PrivateKeyFile,
),
)
}
}, },
} }