Skip to content

Commit

Permalink
mention about cors config in README
Browse files Browse the repository at this point in the history
  • Loading branch information
RoyTakanen committed Jul 17, 2023
1 parent 1ef664a commit 1e0412e
Showing 1 changed file with 15 additions and 1 deletion.
16 changes: 15 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -44,6 +44,20 @@ Creating & viewing a paste looks like this (currently the whole LangAPI implemen
frontend <-- API [label = "return content w/ highlight.js highlight"];
}```](https://kroki.io/seqdiag/svg/eNqNkV9LwzAUxd_9FIc-iANr3-cfUJRRcDqob-JD1lzTSpbO5NYhY9_dpHSbpcX6kIeQ37n3nBNHn7IUCtsT4N1WhslIIL7B7SLFqxZL0rhGtHjOXpCshWNy0dulh8N74B6FUUMsziQx5QztgVoomhx1V3E8oNs26BTrby4qg92R92vmlVHV_d0v3IkvQuMIp42yO78vsMS1NXB1npNrUxwiB0nXzp94r6DZw6GfZFrKEe-KuLW-SbAiFlKw-Kd_KzbIGxvc2dIvdJ5mWfo0w_5DWtUkOvcDdGU9Y0mO_Mp-SNhuUPBKD8jHa2x3h7xFqQrtD198uOMlZNn9AJvHxes=) -->

### cors

// TODO: create a table of env variables

To enable cors you have to set two env variables:
- ENABLE_CORS=true or false (make sure that everything is lower case)
- ALLOWED_CORS_ORIGINS=https://siteyouwanttoallowapiaccess.com (this takes urls separated by commas (no whitespaces allowed), you cannot use * since it does not work with allow credentials). For more information, see: https://www.npmjs.com/package/cors#configuration-options (origin).

Example
```yaml
ENABLE_CORS=true
ALLOWED_CORS_ORIGINS=https://pastebin.fi,http://localhost:3000
```

## Setup

First of all, you should setup the environment variables (see [here](#Configuration-variables)). I would recommend to copy the `.env.example` file to `.env` (command is `cp .env.example .env`).
Expand All @@ -65,4 +79,4 @@ Since the project uses typescript you cannot just start the project with `node .

## Configuration variables

see `.env.example`
see `.env.example`

0 comments on commit 1e0412e

Please sign in to comment.