about summary refs log tree commit diff
path: root/nix/templates/goapp/backend/log.go
diff options
context:
space:
mode:
authorEmile <git@emile.space>2025-02-19 19:53:25 +0100
committerEmile <git@emile.space>2025-02-19 19:53:25 +0100
commitae39f02812bcfe903e956220c890bfb7b9bb9ff4 (patch)
treedff7028627665a7d2cb7cd64533ac74ec8919379 /nix/templates/goapp/backend/log.go
parent07425c679f7399284c0fe3dcbee54f45b23d07a0 (diff)
removed the backend, added the frontend with oidc support
So I've added oidc support which is nice, yet I have to test this
with some https foo, so I'm pushing this.
Diffstat (limited to 'nix/templates/goapp/backend/log.go')
-rw-r--r--nix/templates/goapp/backend/log.go34
1 files changed, 0 insertions, 34 deletions
diff --git a/nix/templates/goapp/backend/log.go b/nix/templates/goapp/backend/log.go
deleted file mode 100644
index 5af719a..0000000
--- a/nix/templates/goapp/backend/log.go
+++ /dev/null
@@ -1,34 +0,0 @@
-package main
-
-import (
-	"net/http"
-	"os"
-
-	"github.com/gorilla/handlers"
-)
-
-// Defines a middleware containing a logfile
-//
-// This is done to combine gorilla/handlers with gorilla/mux middlewares to
-// just use r.Use(logger.Middleware) once instead of adding this to all
-// handlers manually (Yes, I'm really missing macros in Go...)
-type loggingMiddleware struct {
-	logFile *os.File
-}
-
-func (l *loggingMiddleware) Middleware(next http.Handler) http.Handler {
-	return handlers.LoggingHandler(l.logFile, next)
-}
-
-func authMiddleware(next http.Handler) http.Handler {
-	return http.HandlerFunc(func(w http.ResponseWriter, r *http.Request) {
-		session, _ := globalState.sessions.Get(r, "session")
-		username := session.Values["username"]
-
-		if username == nil {
-			http.Redirect(w, r, "/login", http.StatusSeeOther)
-		} else {
-			next.ServeHTTP(w, r)
-		}
-	})
-}