From 2fc8cf7406a26ba608782a6f50386cf687027dea Mon Sep 17 00:00:00 2001
From: jonakj <jonakj@stud.ntnu.no>
Date: Wed, 18 May 2022 11:53:00 +0200
Subject: [PATCH] Added more comments to main.go

---
 main.go | 11 +++++------
 1 file changed, 5 insertions(+), 6 deletions(-)

diff --git a/main.go b/main.go
index 6f17f6d..f7c7320 100644
--- a/main.go
+++ b/main.go
@@ -24,8 +24,8 @@ import (
 func init() {
 	var err error
 
+	// Setting global varaibles in the utils package
 	utils.Ctx = context.Background()
-
 	utils.Config = oauth2.Config{
 		ClientID:     os.Getenv("clientId"),
 		ClientSecret: os.Getenv("clientSecret"),
@@ -49,6 +49,7 @@ func init() {
 
 	utils.Verifier = utils.Provider.Verifier(oidcConfig)
 
+	// Start the redis connection
 	RedisPool := storage.InitPool()
 	utils.Conn = RedisPool.Get()
 
@@ -58,6 +59,7 @@ func init() {
 	utils.APIKeyHybridAnalysis = os.Getenv("APIKeyHybridAnalysis")
 	utils.APIKeyOTX = os.Getenv("APIKeyOTX")
 
+	// Make a blocklist used as a proof-of-concept
 	utils.UrlBlockList = make([]string, 3)
 	utils.UrlBlockList[0] = "ntnu.no"
 	utils.UrlBlockList[1] = "ntnu.edu"
@@ -156,6 +158,8 @@ func main() {
 		}
 	})
 
+	// Escalate endpoint which takes authentication and a case to ecalate through manual analysis.
+	// The user is then sent an email with deatils on the case.
 	r.GET("/escalate", func(c *gin.Context) {
 		token := c.Query("userAuth")
 		url := c.Query("url")
@@ -175,9 +179,4 @@ func main() {
 	})
 
 	log.Fatal(r.Run(":8081"))
-	// These don't do anything, and can't be placed above the line above as they stop the connections prematurely then.
-	/*
-		conn.Close()      // Close the connection
-		redisPool.Close() // Close the pool
-	*/
 }
-- 
GitLab