mirror of
https://github.com/p-stream/docs.git
synced 2026-01-11 20:10:34 +00:00
154 lines
3.9 KiB
Text
154 lines
3.9 KiB
Text
---
|
|
title: 'Configuration'
|
|
---
|
|
|
|
# Backend Config Reference
|
|
|
|
The backend can be configured in 2 different ways:
|
|
|
|
- Make a `.env` file in the working directory of the application (root of repository)
|
|
- Add environment variables to your system (or container)
|
|
|
|
These different config options are all mutually inclusive, so you can use multiple at the same time if you want to.
|
|
|
|
<Warning>
|
|
With any of these configurations, you have to have atleast three variables set
|
|
for the server to function: [`DATABASE_URL`](#database-url-⚠),
|
|
[`CRYPTO_SECRET`](#crypto-secret-⚠) and
|
|
[`META_NAME`](#meta-name-⚠)
|
|
</Warning>
|
|
|
|
### Method 1 - `.env`
|
|
Example:
|
|
```sh
|
|
CRYPTO_SECRET=6abkbIoK3CPU6EVI2wa26WG26VCb7z8v
|
|
```
|
|
|
|
### Method 2 - Environment
|
|
|
|
This method is identical to the `.env` method listed above, but you add the variables to the environment instead of writing it in a file.
|
|
|
|
# Reference
|
|
## Postgres
|
|
|
|
### `PG_USER`
|
|
- Type: `string`
|
|
- Example: `pstream_user`
|
|
|
|
Username for Postgres
|
|
|
|
### `PG_PASSWORD`
|
|
- Type: `string`
|
|
- Example: `Iamaweakpassword`
|
|
|
|
Password for Postgres using something strong. Generate one [here](https://www.random.org/strings/)
|
|
|
|
### `PG_DB`
|
|
- Type: `string`
|
|
- Example: `p-stream_backend`
|
|
|
|
Database name for Postgres
|
|
|
|
## Backend
|
|
|
|
All configurations related to how the backend functions.
|
|
|
|
### `DATABASE_URL` ⚠
|
|
|
|
- Type: `string`
|
|
- Example: `postgresql://pstream_user:6abkbIoK3CPU6EVI2wa26WG26VCb7z8ve@localhost:5432/p-stream_backend`
|
|
- Str: postgresql://PG_USER:PG_PASSWORD@postgres(or localhost):PGPORT/PG_DB
|
|
|
|
Connection URL for postgres instance, should contain the database in the URL.
|
|
|
|
<Caution>
|
|
**Required. The backend will not start if this is not configured.**
|
|
</Caution>
|
|
|
|
## Cryptography
|
|
|
|
All configurations related to cryptography.
|
|
|
|
### `CRYPTO_SECRET` ⚠
|
|
|
|
- Type: `string`
|
|
|
|
The secret used to sign sessions. **Must be at least 32 characters long. [Generate here](https://www.random.org/strings/)**
|
|
|
|
<Caution>
|
|
**Required. The backend will not start if this is not configured.**
|
|
</Caution>
|
|
|
|
## Meta
|
|
|
|
These options configure how the server will display itself to the frontend.
|
|
|
|
### `META_NAME` ⚠
|
|
|
|
- Type: `string`
|
|
- Example: `"Unofficial backend"`
|
|
|
|
The name of the backend instance, this will be displayed to users who try to create an account.
|
|
|
|
<Caution>
|
|
**Required. The backend will not start if this is not configured.**
|
|
</Caution>
|
|
|
|
### `META_DESCRIPTION`
|
|
|
|
- Type: `string`
|
|
- Default: `""`
|
|
- Example: `"This is not an official instance of the backend"`
|
|
|
|
The description of the backend instance, this will be displayed to users who try to create an account.
|
|
|
|
## Captcha
|
|
|
|
All configurations related to adding captcha functionality. Captchas' help to protect your server from bot attacks.
|
|
|
|
### `CAPTCHA`
|
|
|
|
- Type: `boolean`
|
|
- Default: `false`
|
|
|
|
Enables [Recaptcha](https://www.google.com/recaptcha/about/) support for user registration and login. [You can follow this guide to create a Recaptcha key](https://cloud.google.com/recaptcha-enterprise/docs/create-key-website#create-key).
|
|
|
|
<Warning>
|
|
If this is enabled, all other captcha related settings are required.
|
|
</Warning>
|
|
|
|
### `CAPTCHA_CLIENT_KEY`
|
|
|
|
- Type: `string`
|
|
- Default: `""`
|
|
- Example: `"sjgaJ@3djasFVx"`
|
|
|
|
[Google Recaptcha](https://www.google.com/recaptcha/about/) secret key.
|
|
|
|
## TMBD
|
|
All configurations related to adding a private TMBD key.
|
|
Get your [TMBD API KEY](https://www.themoviedb.org/settings/api).
|
|
|
|
### `TMDB_API_KEY`
|
|
|
|
- Type: `string`
|
|
- Default: `""`
|
|
- Example: `"sjgaJ@3djasFVefihdjasidygyuiiii9382222222222ahdlx"`
|
|
|
|
## TRAKT
|
|
|
|
### `TRAKT_CLIENT_ID`
|
|
|
|
- Type: `string`
|
|
- Default: `""`
|
|
- Example: `"sjgaJ@3djasFVefihdjasidygyuiiii9382222222222ahdlx"`
|
|
|
|
### `TRAKT_CLIENT_SECRET`
|
|
|
|
- Type: `string`
|
|
- Default: `""`
|
|
- Example: `"sjgaJ@3djasFVefihdjasidygyuiiii9382222222222ahdlx"`
|
|
|
|
Get your [TRAKT API KEY](https://trakt.tv/oauth/applications).
|
|
Click New Application after you've logged in, enter the name of the app, which doesnt matter, and for redirect url, just do https://google.com, it doesnt matter.
|
|
|