hotfix(backend): create real error for missing JWT_SECRET

This commit is contained in:
Abdulmujeeb Raji 2023-07-31 15:44:38 +01:00
parent 30fd524747
commit 4c536581e1
2 changed files with 2 additions and 2 deletions

View file

@ -8,7 +8,7 @@ and initialize it with the `sql/init.sql` script:
$ cat sql/init.sql | sqlite3 users.db $ cat sql/init.sql | sqlite3 users.db
``` ```
You also need to create a `.env` file with the following variables: You need to create a `.env` file with the following variables:
- `JWT_SECRET`: Required. A cryptographically secure string used to encode - `JWT_SECRET`: Required. A cryptographically secure string used to encode
tokens. tokens.

View file

@ -55,7 +55,7 @@ func NewUserHandler() (*UserHandler, error) {
jwt_secret_str := os.Getenv("JWT_SECRET") jwt_secret_str := os.Getenv("JWT_SECRET")
// Return any errors // Return any errors
if jwt_secret_str == "" { if jwt_secret_str == "" {
return nil, err return nil, errors.New("no JWT_SECRET provided in .env")
} }
jwt_secret := []byte(jwt_secret_str) jwt_secret := []byte(jwt_secret_str)