chore: add readme edits
This commit is contained in:
@@ -1,3 +1,11 @@
|
||||
# Eden
|
||||
# Orbits
|
||||
|
||||
Environmental Display & Engagement Network (EDEN)
|
||||
Orchestrated Remote Broadcast Integrated Terminal System (ORBITS)
|
||||
|
||||
Orbit + Bits
|
||||
|
||||
```sh
|
||||
root@ubuntu01:~# systemctl --user --machine=dselen@ stop kiosk-firefox^C
|
||||
root@ubuntu01:~# systemctl --user --machine=dselen@ daemon-reload
|
||||
root@ubuntu01:~# systemctl --user --machine=dselen@ start kiosk-firefox
|
||||
```
|
||||
|
||||
+1
-1
@@ -20,7 +20,7 @@ func main() {
|
||||
slog.SetDefault(logger)
|
||||
|
||||
// print our running environment variable set
|
||||
slog.Debug("displaying environment", "env", env)
|
||||
slog.Debug("displaying environment variables", "environment", env)
|
||||
|
||||
// TO DO, allow cmd args parsing
|
||||
|
||||
|
||||
+2
-1
@@ -3,6 +3,7 @@ package api
|
||||
import (
|
||||
"fmt"
|
||||
"log/slog"
|
||||
"orbits-server/internal/api/middleware"
|
||||
"orbits-server/internal/utility"
|
||||
|
||||
"github.com/gin-gonic/gin"
|
||||
@@ -29,7 +30,7 @@ func KickoffApi(logger *slog.Logger, env utility.Environment, db *gorm.DB) {
|
||||
// r := gin.Default()
|
||||
// JSON logger: https://gin-gonic.com/en/docs/logging/structured-logging/
|
||||
r := gin.New()
|
||||
r.Use(slogGinMiddleware(logger))
|
||||
r.Use(middleware.SlogMiddleware(logger))
|
||||
r.Use(gin.Recovery())
|
||||
|
||||
api := r.Group("/api")
|
||||
|
||||
@@ -1,13 +1,14 @@
|
||||
package api
|
||||
package middleware
|
||||
|
||||
import (
|
||||
"log/slog"
|
||||
"net/http"
|
||||
"time"
|
||||
|
||||
"github.com/gin-gonic/gin"
|
||||
)
|
||||
|
||||
func slogGinMiddleware(logger *slog.Logger) gin.HandlerFunc {
|
||||
func SlogMiddleware(logger *slog.Logger) gin.HandlerFunc {
|
||||
return func(c *gin.Context) {
|
||||
start := time.Now()
|
||||
path := c.Request.URL.Path
|
||||
@@ -32,3 +33,14 @@ func slogGinMiddleware(logger *slog.Logger) gin.HandlerFunc {
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
func AuthMiddleware() gin.HandlerFunc {
|
||||
return func(c *gin.Context) {
|
||||
orbitsKey := c.GetHeader("orbits-key")
|
||||
if len(orbitsKey) == 0 {
|
||||
c.AbortWithStatus(http.StatusUnauthorized)
|
||||
return
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user