Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

docs: add info about generating enviroment variable SECRET_KEY_SIGN #163

Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
16 changes: 8 additions & 8 deletions docs/backend/Enviroment.md
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ In this document we will cover:
- Enviroment variables usage
- Development enviroment variables

## How to use enviroments
## 🖐️ How to use enviroments

To use environments in the app, you will need to place a file named `.env` under the `Backend` folder. The file should contain key-value pairs, with each pair on a separate line and the key and value separated by an equals sign (`=`). For example:

Expand All @@ -16,21 +16,21 @@ KEY1=value1

_Note that file has to be named `.env` not `.env.local` or similars, having a different name will not make its variables part of the enviroment variables_ recognized by the backend.

## Enviroments variables
## 📄 Enviroments variables

In this section we will explain the meaning and the usage of the enviroment variables. Some of them are only necessary for one [architecture](../Architecture.md), this means you can not declared them at all at the `.env` file.

### Commons
### ➡️ Commons

- **SECRET_KEY_SIGN**: 32 byte key for signing JWT Tokens that will authenticate the user. You can use `f24e2f3ac557d487b6d879fb2d86f2b2` as an example. This key will make sure the JWT Tokens are provided by our backend and not someone else's.
- **SECRET_KEY_SIGN**: 32 byte key for signing JWT Tokens that will authenticate the user. You can use `f24e2f3ac557d487b6d879fb2d86f2b2` as an example. This key will make sure the JWT Tokens are provided by our backend and not someone else's. For generating a new secret use `openssl rand -hex 32`.
- **ENV_VALUE**: determines the current enviroment of the app, it can be:
- `PROD`: production enviroment.
- `DEV`: development enviroment. Enables hot reload.
- **ARCH**: the song architecture selected, it can be one of the following [architectures](../Architecture.md):
- `STREAMING_SERVERLESS_FUNCTION`: song architecture using AWS Serverless Function with streaming.
- `BLOB(Recommended for testing)`: song architecture with no streaming/cloud, storing and serving songs directly from the database.

### Streaming using AWS Serverless Functions (`STREAMING_SERVERLESS_FUNCTION`)
### ➡️ Streaming using AWS Serverless Functions (`STREAMING_SERVERLESS_FUNCTION`)

- **SERVERLESS_FUNCTION_URL**: the url of the AWS serverless function (Lambda) that manages songs and comunicates with cloud storage.
- **MONGO_URI**: the database connection URI such as `mongodb://root:root@localhost:27017/`, this will connect backend into the selected database for storing all persistent data but not including song files.
Expand All @@ -43,7 +43,7 @@ ENV_VALUE=DEV
ARCH=STREAMING_SERVERLESS_FUNCTION
```

### No streaming with songs stored in database (`BLOB`)
### ➡️ No streaming with songs stored in database (`BLOB`)

- **MONGO_URI**: the database connection URI such as `mongodb://root:root@localhost:27017/`, this will connect backend into the selected database for storing all persistent including the song files.

Expand All @@ -56,7 +56,7 @@ ARCH=BLOB

---

## DEVELOPMENT READY ENVIROMENT
## DEVELOPMENT READY ENVIROMENT

The following file can be used out of the box for development purpouse. It contains the following characteristics:

Expand All @@ -74,7 +74,7 @@ ARCH=BLOB

---

## ALL ROUND ENVIROMENT
## 🪨 ALL ROUND ENVIROMENT

You can also use the following `.env` file for changing between architectures as it contains all the variables needed. Just be sure to fill the the needed enviroments for the architecture seleted.

Expand Down