diff options
| author | Zach Berwaldt <zberwaldt@tutamail.com> | 2024-03-07 19:56:34 -0500 |
|---|---|---|
| committer | Zach Berwaldt <zberwaldt@tutamail.com> | 2024-03-07 19:56:34 -0500 |
| commit | 29f83e05270d0012ad9f273ac3364106fcff5f50 (patch) | |
| tree | c7b5df7cc21d6d2eb69950c57575a73bc598d809 /api/internal/database | |
| parent | 6651daca670664f3de8af9c7bcb74b1e7c6c6be9 (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/database')
| -rw-r--r-- | api/internal/database/database.go | 2 |
1 files changed, 1 insertions, 1 deletions
diff --git a/api/internal/database/database.go b/api/internal/database/database.go index e313af5..19ae818 100644 --- a/api/internal/database/database.go +++ b/api/internal/database/database.go | |||
| @@ -14,7 +14,7 @@ func SetupDatabase() { | |||
| 14 | } | 14 | } |
| 15 | 15 | ||
| 16 | func EstablishDBConnection() *sql.DB { | 16 | func EstablishDBConnection() *sql.DB { |
| 17 | db, err := sql.Open("sqlite3", "../db/water.sqlite3") | 17 | db, err := sql.Open("sqlite3", "../../db/water.sqlite3") |
| 18 | if err != nil { | 18 | if err != nil { |
| 19 | panic(err) | 19 | panic(err) |
| 20 | } | 20 | } |
