Skip to content

Feature/dotenv

Asone requested to merge Asone/tricoteuses-api-assemblee:feature/dotenv into master

This PR adds a dependency to dotenv and allow to use environment variables into the project.

In this specific PR we use dotenv in order to specify the list of CORS hosts the server should allow to connect.

For this we modified the main.rs file of the web-server module. The script will load environments variable, check if there's any input for ALLOWED_HOSTS and will push those inside the list of hosts already hard-coded into the code.

You should be able to chain multiple hosts :

ALLOWED_HOSTS=0.0.0.0,1.1.1.1,2.2.2.2

.env file is not mandatory and server should be able to run even if not present.

/!\ Note that the .env file is not provided (and is marked in .gitignore), each instance of the project will have to specify its own. However, a .env.dist is provided as the generic one in order to help devs to aknowledge what environment variables are used/available

/!\ Note also that i deleted the https://assemblee.api.tricoteuses.fr url and moved it into the .env.dist file.

Don't forget to add the .env file generation in the CD pipe of project.

Edited by Asone

Merge request reports