diff --git a/controllers/userController.go b/controllers/userController.go index 7dbf840..5f93c33 100644 --- a/controllers/userController.go +++ b/controllers/userController.go @@ -94,12 +94,6 @@ func CreateUser(c *gin.Context) { func AuthenticateUser(c *gin.Context) { - isLoggedIn := isLoggedIn(c) - if !isLoggedIn { - throwError(http.StatusUnauthorized, UNAUTHORIZED, c) - return - } - var authUser = UserForm{} if err := c.Bind(&authUser); err != nil { throwError(http.StatusBadRequest, err.Error(), c) diff --git a/medialog.go b/medialog.go index 391adb0..6018dbc 100644 --- a/medialog.go +++ b/medialog.go @@ -58,15 +58,18 @@ func main() { panic(err) } - logFile, err := os.OpenFile(env.LogLocation, os.O_APPEND|os.O_WRONLY|os.O_CREATE, 0755) - if err != nil { - panic(err) - } - defer logFile.Close() - log.SetOutput(logFile) + if prod { + logFile, err := os.OpenFile(env.LogLocation, os.O_APPEND|os.O_WRONLY|os.O_CREATE, 0755) + if err != nil { + panic(err) + } + defer logFile.Close() - log.Println("Medialog starting up") - log.Println("Setting Up Router") + log.SetOutput(logFile) + + log.Println("Medialog starting up") + log.Println("Setting Up Router") + } r, err = router.SetupRouter(env, gormDebug, prod) if err != nil { diff --git a/router/router.go b/router/router.go index 2c1e018..46ad0a6 100644 --- a/router/router.go +++ b/router/router.go @@ -17,15 +17,14 @@ func SetupRouter(env config.Environment, gormDebug bool, prod bool) (*gin.Engine log.Println("Medialog starting up") - log.Println(" ** Configuring Gin logger") - //configure logger - gin.DisableConsoleColor() - f, _ := os.OpenFile(env.LogLocation, os.O_APPEND|os.O_WRONLY|os.O_CREATE, 0755) - defer f.Close() - gin.DefaultWriter = io.MultiWriter(f) - if prod { gin.SetMode(gin.ReleaseMode) + log.Println(" ** Configuring Gin logger") + //configure logger + gin.DisableConsoleColor() + f, _ := os.OpenFile(env.LogLocation, os.O_APPEND|os.O_WRONLY|os.O_CREATE, 0755) + defer f.Close() + gin.DefaultWriter = io.MultiWriter(f) } log.Println(" ** Setting up router")