From b8186444e7d71611013d879c4d70a152618dac3f Mon Sep 17 00:00:00 2001 From: Bastien DUMONT <bdumont@grandlyon.com> Date: Thu, 8 Aug 2024 15:24:17 +0200 Subject: [PATCH] chore: fix get GRDF access token --- main.go | 32 ++++++++++++++++---------------- 1 file changed, 16 insertions(+), 16 deletions(-) diff --git a/main.go b/main.go index c8dbfb5..baa3d5c 100644 --- a/main.go +++ b/main.go @@ -39,25 +39,25 @@ func main() { mockOAuth2Port := ":8090" go http.ListenAndServe(mockOAuth2Port, mocks.CreateMockOAuth2()) fmt.Println("Mock OAuth2 server Listening on: http://localhost" + mockOAuth2Port) + } - // Call the function immediately when the server starts - models.FetchGRDFAuthAPI() + // Call the function immediately when the server starts + models.FetchGRDFAuthAPI() - // then call GRDF auth api every two hours - ticker := time.NewTicker(time.Hour * 2) - quit := make(chan struct{}) - go func() { - for { - select { - case <-ticker.C: - models.FetchGRDFAuthAPI() - case <-quit: - ticker.Stop() - return - } + // then call GRDF auth api every two hours + ticker := time.NewTicker(time.Hour * 2) + quit := make(chan struct{}) + go func() { + for { + select { + case <-ticker.C: + models.FetchGRDFAuthAPI() + case <-quit: + ticker.Stop() + return } - }() - } + } + }() // Serve locally with https log.Fatal(http.ListenAndServeTLS(":"+strconv.Itoa(httpsPort), "./dev_certificates/localhost.crt", "./dev_certificates/localhost.key", rootMux.Router)) -- GitLab