From 72ec551e6cb422531e543e3fb431324aed5ac025 Mon Sep 17 00:00:00 2001 From: Gabriel Arakaki Giovanini Date: Sun, 13 Aug 2023 18:40:49 +0200 Subject: feat: Add better tooling for running the project * Add watch option for hot reload(ish). * Read from `.env` file. This make local development a bit easier since now can easily run the application with custom configuration. --- cmd/server/main.go | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) (limited to 'cmd/server') diff --git a/cmd/server/main.go b/cmd/server/main.go index a3d5124..035d00a 100644 --- a/cmd/server/main.go +++ b/cmd/server/main.go @@ -2,7 +2,7 @@ package main import ( "context" - "encoding/hex" + "encoding/base64" "errors" "net/http" "os" @@ -66,7 +66,7 @@ func main() { *schedulerCount = 1 } - hexKey, err := hex.DecodeString(*key) + baseKey, err := base64.StdEncoding.DecodeString(*key) if err != nil { panic("failed to decode key database: " + err.Error()) } @@ -84,7 +84,7 @@ func main() { // middleware var ( - authMiddleware = ext.NewAuthMiddleware(hexKey, logger.WithField("context", "auth")) + authMiddleware = ext.NewAuthMiddleware(baseKey, logger.WithField("context", "auth")) logMiddleware = ext.NewLogMiddleare(logger.WithField("context", "http")) initialMiddleware = ext.NewInitialSetupMiddleware(userRepository) ) @@ -99,7 +99,7 @@ func main() { // controller var ( - userController = service.NewAuthController(userRepository, userRepository, hexKey) + userController = service.NewAuthController(userRepository, userRepository, baseKey) fileSystemController = service.NewFileSystemController(fileSystemRepository, userRepository) ) -- cgit v1.2.3