From 4ce3d9f60bc3770d40def89d931e81a47682be7a Mon Sep 17 00:00:00 2001 From: Victor Lacasse-Beaudoin Date: Wed, 3 Jul 2024 20:51:57 -0400 Subject: [PATCH] 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}` --- cmd.go | 17 ++++++++++++++++- 1 file changed, 16 insertions(+), 1 deletion(-) diff --git a/cmd.go b/cmd.go index 8c5571d..508af62 100644 --- a/cmd.go +++ b/cmd.go @@ -114,7 +114,22 @@ var apiCmd = &cobra.Command{ */ // 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, + ), + ) + } }, }