aboutsummaryrefslogtreecommitdiff
path: root/api/internal/controllers/auth.go
diff options
context:
space:
mode:
authorZach Berwaldt <zberwaldt@tutamail.com>2024-03-07 19:56:34 -0500
committerZach Berwaldt <zberwaldt@tutamail.com>2024-03-07 19:56:34 -0500
commit29f83e05270d0012ad9f273ac3364106fcff5f50 (patch)
treec7b5df7cc21d6d2eb69950c57575a73bc598d809 /api/internal/controllers/auth.go
parent6651daca670664f3de8af9c7bcb74b1e7c6c6be9 (diff)
chore: Update paths in test and database configuration
This commit updates the paths in the test suite and database configuration to reflect the new directory structure. In the `api/cmd/main_test.go` file, the path for the config file is changed from `viper.SetConfigName(".env")` to `viper.SetConfigFile("../.env")` and `viper.AddConfigPath(".")` is added for configuration purposes. Additionally, `viper.AutomaticEnv()` is added to enable automatic environment variable configuration. In the same file, error handling is improved by adding explicit checks and error messages. The `api/internal/database/database.go` file is also modified, updating the path for database initialization from `"../db/water.sqlite3"` to `"../../db/water.sqlite3"`. These changes ensure proper configuration and functioning of the application.
Diffstat (limited to 'api/internal/controllers/auth.go')
-rw-r--r--api/internal/controllers/auth.go14
1 files changed, 7 insertions, 7 deletions
diff --git a/api/internal/controllers/auth.go b/api/internal/controllers/auth.go
index 744a884..de9ed05 100644
--- a/api/internal/controllers/auth.go
+++ b/api/internal/controllers/auth.go
@@ -1,17 +1,17 @@
1package controllers 1package controllers
2 2
3import ( 3import (
4 "encoding/base64"
5 "net/http"
6 "github.com/gin-gonic/gin"
7 "water/api/database"
8 "errors"
9 "crypto/rand" 4 "crypto/rand"
10 "database/sql" 5 "database/sql"
11 6 "encoding/base64"
12 "water/api/models" 7 "errors"
8 "github.com/gin-gonic/gin"
9 "net/http"
10 "water/api/internal/models"
11
13 _ "github.com/mattn/go-sqlite3" 12 _ "github.com/mattn/go-sqlite3"
14 "golang.org/x/crypto/bcrypt" 13 "golang.org/x/crypto/bcrypt"
14 "water/api/internal/database"
15) 15)
16 16
17func AuthHandler (c *gin.Context) { 17func AuthHandler (c *gin.Context) {