Show warning when PUBLIC_URL isn't correctly configured (#6840)

Closes #6539
This commit is contained in:
Rijk van Zanten
2021-07-15 23:20:35 +02:00
committed by GitHub
parent ce1748c354
commit 262e8cdbb8
2 changed files with 18 additions and 9 deletions

View File

@@ -47,6 +47,12 @@ import { session } from './middleware/session';
export default async function createApp(): Promise<express.Application> {
validateEnv(['KEY', 'SECRET']);
try {
new URL(env.PUBLIC_URL);
} catch {
logger.warn('PUBLIC_URL is not a valid URL');
}
await validateDBConnection();
if ((await isInstalled()) === false) {

View File

@@ -7,15 +7,18 @@
## General
| Variable | Description | Default Value |
| ------------------ | ---------------------------------------------------------------------------------------------------------- | ------------- |
| `CONFIG_PATH` | Where your config file is located. See [Config Files](/reference/config-files/) | `.env` |
| `PORT` | What port to run the API under. | `8055` |
| `PUBLIC_URL` | URL where your API can be reached on the web. | `/` |
| `LOG_LEVEL` | What level of detail to log. One of `fatal`, `error`, `warn`, `info`, `debug`, `trace` or `silent`. | `info` |
| `LOG_STYLE` | Render the logs human readable (pretty) or as JSON. One of `pretty`, `raw`. | `pretty` |
| `MAX_PAYLOAD_SIZE` | Controls the maximum request body size. Accepts number of bytes, or human readable string. | `100kb` |
| `ROOT_REDIRECT` | Where to redirect to when navigating to `/`. Accepts a relative path, absolute URL, or `false` to disable. | `./admin` |
| Variable | Description | Default Value |
| -------------------------- | ---------------------------------------------------------------------------------------------------------- | ------------- |
| `CONFIG_PATH` | Where your config file is located. See [Config Files](/reference/config-files/) | `.env` |
| `PORT` | What port to run the API under. | `8055` |
| `PUBLIC_URL`<sup>[1]</sup> | URL where your API can be reached on the web. | `/` |
| `LOG_LEVEL` | What level of detail to log. One of `fatal`, `error`, `warn`, `info`, `debug`, `trace` or `silent`. | `info` |
| `LOG_STYLE` | Render the logs human readable (pretty) or as JSON. One of `pretty`, `raw`. | `pretty` |
| `MAX_PAYLOAD_SIZE` | Controls the maximum request body size. Accepts number of bytes, or human readable string. | `100kb` |
| `ROOT_REDIRECT` | Where to redirect to when navigating to `/`. Accepts a relative path, absolute URL, or `false` to disable. | `./admin` |
<sup>[1]</sup> The PUBLIC_URL value is used for things like oAuth redirects, forgot-password emails, and logos that
needs to be publicly available on the internet.
## Database