docs: set rejectUnauthorized based on condition (#5907)

The general guide for hosting the server tells users to set `ssl.rejectUnauthorized` to false for production environments. However, the provided code snippet doesn't check the environment while setting the value. Directly pasting it into `medusa-config.js` will cause database connection attempts made from a development environment to be rejected and you can't even login to the admin account.

The change only sets the ssl property to false if the environment is a non-development one.  ~I got this code suggestion from the Kapa bot on discord so not sure if this is the best way to do this.~ This code is taken from the [configuration docs](https://docs.medusajs.com/development/backend/configurations#database_extra) themselves.

Co-authored-by: Shahed Nasser <27354907+shahednasser@users.noreply.github.com>
This commit is contained in:
Sujal Gurung
2023-12-18 18:12:10 +05:45
committed by GitHub
parent ddc6cc13a0
commit bd60efbe65

View File

@@ -39,7 +39,12 @@ In production, its recommended to set the [database_extra option](../../devel
module.exports = {
projectConfig: {
// ...
database_extra: { ssl: { rejectUnauthorized: false } },
database_extra: process.env.NODE_ENV !== "development" ?
{
ssl: {
rejectUnauthorized: false,
},
} : {},
},
}
```