func TokenAuthMiddleware(handler http.HandlerFunc) http.HandlerFunc {
	return func(w http.ResponseWriter, r *http.Request) {
		envToken := strings.TrimSpace(os.Getenv("LEDGER_AUTH_TOKEN"))
		if envToken != "" {
			requestToken := strings.TrimSpace(r.Header.Get("Authorization"))
			if requestToken != envToken {
				w.WriteHeader(http.StatusUnauthorized)
				return
			}
		}
		handler.ServeHTTP(w, r)
	}
}
TokenAuthMiddleware is a middleware that provides authentication functionality
package middlewares
import (
	"net/http"
	"os"
	"strings"
)