From 4c536581e18b9a84d0d4dadb9d911a5858bc90a5 Mon Sep 17 00:00:00 2001 From: Abdulmujeeb Raji Date: Mon, 31 Jul 2023 15:44:38 +0100 Subject: [PATCH] hotfix(backend): create real error for missing JWT_SECRET --- backend/README.md | 2 +- backend/user.go | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/backend/README.md b/backend/README.md index 9eeeb64..2b1f97a 100644 --- a/backend/README.md +++ b/backend/README.md @@ -8,7 +8,7 @@ and initialize it with the `sql/init.sql` script: $ 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 tokens. diff --git a/backend/user.go b/backend/user.go index 2a63882..95f1ef4 100644 --- a/backend/user.go +++ b/backend/user.go @@ -55,7 +55,7 @@ func NewUserHandler() (*UserHandler, error) { jwt_secret_str := os.Getenv("JWT_SECRET") // Return any errors if jwt_secret_str == "" { - return nil, err + return nil, errors.New("no JWT_SECRET provided in .env") } jwt_secret := []byte(jwt_secret_str)