Skip to content
Snippets Groups Projects
Commit 2fc8cf74 authored by Jonas Kjærandsen's avatar Jonas Kjærandsen
Browse files

Added more comments to main.go

parent 095be8b3
No related branches found
No related tags found
No related merge requests found
...@@ -24,8 +24,8 @@ import ( ...@@ -24,8 +24,8 @@ import (
func init() { func init() {
var err error var err error
// Setting global varaibles in the utils package
utils.Ctx = context.Background() utils.Ctx = context.Background()
utils.Config = oauth2.Config{ utils.Config = oauth2.Config{
ClientID: os.Getenv("clientId"), ClientID: os.Getenv("clientId"),
ClientSecret: os.Getenv("clientSecret"), ClientSecret: os.Getenv("clientSecret"),
...@@ -49,6 +49,7 @@ func init() { ...@@ -49,6 +49,7 @@ func init() {
utils.Verifier = utils.Provider.Verifier(oidcConfig) utils.Verifier = utils.Provider.Verifier(oidcConfig)
// Start the redis connection
RedisPool := storage.InitPool() RedisPool := storage.InitPool()
utils.Conn = RedisPool.Get() utils.Conn = RedisPool.Get()
...@@ -58,6 +59,7 @@ func init() { ...@@ -58,6 +59,7 @@ func init() {
utils.APIKeyHybridAnalysis = os.Getenv("APIKeyHybridAnalysis") utils.APIKeyHybridAnalysis = os.Getenv("APIKeyHybridAnalysis")
utils.APIKeyOTX = os.Getenv("APIKeyOTX") utils.APIKeyOTX = os.Getenv("APIKeyOTX")
// Make a blocklist used as a proof-of-concept
utils.UrlBlockList = make([]string, 3) utils.UrlBlockList = make([]string, 3)
utils.UrlBlockList[0] = "ntnu.no" utils.UrlBlockList[0] = "ntnu.no"
utils.UrlBlockList[1] = "ntnu.edu" utils.UrlBlockList[1] = "ntnu.edu"
...@@ -156,6 +158,8 @@ func main() { ...@@ -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) { r.GET("/escalate", func(c *gin.Context) {
token := c.Query("userAuth") token := c.Query("userAuth")
url := c.Query("url") url := c.Query("url")
...@@ -175,9 +179,4 @@ func main() { ...@@ -175,9 +179,4 @@ func main() {
}) })
log.Fatal(r.Run(":8081")) 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
*/
} }
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment