summaryrefslogtreecommitdiff
path: root/cmd
diff options
context:
space:
mode:
authorJulien Dessaux2024-10-01 08:47:32 +0200
committerJulien Dessaux2024-10-01 08:47:32 +0200
commit2cdbc4e782c7ad7f42b1ddd3b7be6a24dea580e7 (patch)
treedb8793f6f06017b7faf1c618fadbe504b77b9231 /cmd
parentfeat(tfstated): implement GET and POST methods, states are encrypted in a sql... (diff)
downloadtfstated-2cdbc4e782c7ad7f42b1ddd3b7be6a24dea580e7.tar.gz
tfstated-2cdbc4e782c7ad7f42b1ddd3b7be6a24dea580e7.tar.bz2
tfstated-2cdbc4e782c7ad7f42b1ddd3b7be6a24dea580e7.zip
feat(logger): implement a logger middleware
Diffstat (limited to 'cmd')
-rw-r--r--cmd/tfstated/main.go3
-rw-r--r--cmd/tfstated/routes.go1
2 files changed, 3 insertions, 1 deletions
diff --git a/cmd/tfstated/main.go b/cmd/tfstated/main.go
index 61248bc..cf93976 100644
--- a/cmd/tfstated/main.go
+++ b/cmd/tfstated/main.go
@@ -14,6 +14,7 @@ import (
"time"
"git.adyxax.org/adyxax/tfstated/pkg/database"
+ "git.adyxax.org/adyxax/tfstated/pkg/logger"
)
type Config struct {
@@ -49,7 +50,7 @@ func run(
httpServer := &http.Server{
Addr: net.JoinHostPort(config.Host, config.Port),
- Handler: mux,
+ Handler: logger.Middleware(mux),
}
go func() {
log.Printf("listening on %s\n", httpServer.Addr)
diff --git a/cmd/tfstated/routes.go b/cmd/tfstated/routes.go
index 32ab111..853970a 100644
--- a/cmd/tfstated/routes.go
+++ b/cmd/tfstated/routes.go
@@ -11,6 +11,7 @@ func addRoutes(
db *database.DB,
) {
mux.Handle("GET /healthz", handleHealthz())
+
mux.Handle("GET /", handleGet(db))
mux.Handle("POST /", handlePost(db))
}