Newer
Older
"forge.grandlyon.com/web-et-numerique/llle_project/backoffice-server/internal/common"
"forge.grandlyon.com/web-et-numerique/llle_project/backoffice-server/internal/mocks"
"forge.grandlyon.com/web-et-numerique/llle_project/backoffice-server/internal/rootmux"
"forge.grandlyon.com/web-et-numerique/llle_project/backoffice-server/internal/tokens"
httpsPort = common.IntValueFromEnv("HTTPS_PORT", 443) // HTTPS port to serve on
debugMode = common.BoolValueFromEnv("DEBUG_MODE", false) // Debug mode, disable Secure attribute for cookies
mockOAuth2 = common.BoolValueFromEnv("MOCK_OAUTH2", false) // Enable mock OAuth2 login
tokens.Init("./mnt/configs/tokenskey.json", debugMode)
rootMux := rootmux.CreateRootMux()
if mockOAuth2 {
mockOAuth2Port := ":8090"
go http.ListenAndServe(mockOAuth2Port, mocks.CreateMockOAuth2())
fmt.Println("Mock OAuth2 server Listening on: http://localhost" + mockOAuth2Port)
}
// Serve locally with https
log.Fatal(http.ListenAndServeTLS(":"+strconv.Itoa(httpsPort), "./dev_certificates/localhost.crt", "./dev_certificates/localhost.key", rootMux.Router))
// log.Fatal(http.ListenAndServe(":"+strconv.Itoa(httpsPort), rootMux.Router))