diff --git a/main.go b/main.go index c8dbfb54fcf6e0729a3509ff78967f414a11db4c..baa3d5cb59a1e6ab4a0f15a646020afb2082146a 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))