Update Environment Variables

Corban-Lee Jones 2024-08-27 19:34:17 +00:00
parent 5a343ad22a
commit 43562f26ef

@ -2,6 +2,10 @@
This wiki covers the environment variables used in this application, their purposes and what values you should use.
There are two ways you can pass parameters into the app using environment variables:
1. Using a `.env` file (best for development)
2. Setting them manually, usually via Docker (best for production)
## Security
#### `DEBUG`
@ -17,6 +21,15 @@ Example value: `True` or `False`
**Optional / Default `unsecure-default-secret-key`**
Your secret key should be secure, unique and unpredictable, it is advised that you create one using the following steps:
1. launch the Django Shell using `django-admin shell`, which can be executed from the same environment where Django is installed.
2. paste the following code, and hit 'enter' `from django.core.management.utils import get_random_secret_key; get_random_secret_key(); exit();`
3. your new secret key will be output, surrounded by single quotes `'`, discard the surrounding quotes and you have your secret key!
[Learn more here](https://docs.djangoproject.com/en/5.0/ref/settings/#std-setting-SECRET_KEY).
Example value: `qc!dypv=k(wau%$-c943bk2!=7wbx!%5_4-ncssjyu((bwzs59`
#### `SUPERUSER_IDS`
**Optional / No Default**
@ -55,19 +68,49 @@ Example value: `DFHjQNR5Rwd9tTmNNSvUrdBqAy34liL5` (This example is a randomly ge
#### `DISCORD_SCOPES`
**Required / Default `identity,guilds`**
**Optional / Default `identity,guilds`**
The scopes that the Discord Application holds over users who authenticate through it.
There is no real reason for you to change this value, and it is recommended that you leave it as is.
Example value `identity,guilds` (comma separated)
#### `DISCORD_REDIRECT_URL`
**Required / No Default**
Obtainable through the OAuth2 tab > Redirects, when viewing your Discord Application. You will need to create one if you haven't already.
It should match your `HOST` environment variable, but include the necessary protocol (`http://` or `https://`), and include the path specified in the example.
Example value: `https://pyrss.example.com/oauth2/login/redirect`
#### `DISCORD_OAUTH2_URL`
**Required / No Default**
The URL used to authenticate a user with your Discord Application, you can construct this yourself with the following components:
- Client ID (a previously covered environment variable)
- Discord Scopes (a previously covered environment variable)
- Redirect URI (a previously covered environment variable)
> [!IMPORTANT]
> For the purposes of this example value, you should replace the commas in the scopes with plus symbols (`identity,guilds` to `identity+guilds`).
Example value: `https://discord.com/oauth2/authorize?client_id=<CLIENT ID>&response_type=code&redirect_uri=<REDIRECT URI>&scope=<SCOPES>`
#### `DISCORD_INVITE_URL`
**Required / No Default**
#### `DISCORD_REDIRECT_URL`
The URL used to invite the Bot side of PYRSS to any given Discord server, it has a similar, yet different structure to the `DISCORD_OAUTH2_URL` environment variable. It requires:
- Client ID (a previously covered environment variable)
- Permissions Integer (A value that determines the bot's permissions within the server joined using this URL)
**Required / No Default**
> [!NOTE]
> The scope in this example URL should not be changed, as it is the only scope required for the function of this URL.
> The permissions integer should need to change from the example, but there is a calculated for it on the Discord Developer Portal should you need to change it.
Example value: `https://discord.com/oauth2/authorize?client_id=<CLIENT ID>&permissions=139586750528&scope=applications.commands+bot`
#### `DISCORD_API_URL`
@ -82,6 +125,8 @@ Example value: `https://discord.com/api/v9`
**Required / No Default**
The authentication token for your Discord Bot.
## Database
https://docs.djangoproject.com/en/5.0/ref/settings/#databases