hotfix(backend): create real error for missing JWT_SECRET
This commit is contained in:
parent
30fd524747
commit
4c536581e1
|
@ -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.
|
||||||
|
|
|
@ -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)
|
||||||
|
|
||||||
|
|
Reference in a new issue