aboutsummaryrefslogtreecommitdiff
path: root/cmd/server/main.go
diff options
context:
space:
mode:
authorGabriel Arakaki Giovanini <mail@gabrielgio.me>2023-08-13 18:40:49 +0200
committerGabriel Arakaki Giovanini <mail@gabrielgio.me>2023-08-13 18:40:49 +0200
commit72ec551e6cb422531e543e3fb431324aed5ac025 (patch)
tree5919c6a20f64868ce7bad68c5094d4612accdb27 /cmd/server/main.go
parent5f660b309bc695277c67223520499fcc13f3c59f (diff)
downloadlens-72ec551e6cb422531e543e3fb431324aed5ac025.tar.gz
lens-72ec551e6cb422531e543e3fb431324aed5ac025.tar.bz2
lens-72ec551e6cb422531e543e3fb431324aed5ac025.zip
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.
Diffstat (limited to 'cmd/server/main.go')
-rw-r--r--cmd/server/main.go8
1 files changed, 4 insertions, 4 deletions
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)
)