Skip to content
Snippets Groups Projects

Add documentation

All threads resolved!
2 files
+ 38
13
Compare changes
  • Side-by-side
  • Inline

Files

@@ -47,12 +47,12 @@ in the projet to validate json files created by the user.
First of all, you need to clone the repository:
```bash
$ git clone --recurse-submodule ssh://git@ssh.hesge.ch:10572/dojo_project/projects/backend/dojobackendapi.git
$ git clone --recurse-submodule https://gitedu.hesge.ch/dojo_project/projects/backend/dojobackendapi.git
```
Then, you need to move to the project's directory:
```bash
$ cd ExpressAPI
$ cd dojobackendapi/ExpressAPI
```
To install the dependencies listed above you can use the following command in the base directory of the project:
@@ -66,27 +66,47 @@ $ npm install
Environment variables are used to store sensitive information such as API keys, passwords, etc.
They are also used to store configuration information that can be changed without modifying the code.
You can decrypt env var stored in the `.env.vault` file with the following commands in the project's main folder:
### Using on your development machine
To use environment variables on your development machine, you need the `.env.keys` file in addition of the `.env.vault`
file present in the repository.
**The `.env.keys` file have to be requested to the project maintainer: [Michaël Minelli](mailto:dojo@minelli.me).**
### Decrypting the environment variables
You can decrypt env var stored in the `.env.vault` file with the following commands in the project's main folder.
Here is an example of how to decrypt the environment variables for the development environment:
```bash
> npx dotenv-vault local keys
$ npx dotenv-vault local keys
environment DOTENV_KEY
─────────── ─────────────────────────────────────────────────────────────────────────
development dotenv://:key_1234@dotenv.local/vault/.env.vault?environment=development
Set DOTENV_KEY on your server
> npx dotenv-vault local decrypt dotenv://:key_1234@dotenv.local/vault/.env.vault?environment=development > .env.development
$ npx dotenv-vault local decrypt 'dotenv://:key_1234@dotenv.local/vault/.env.vault?environment=development' > .env.development
```
**The `.env.keys` file have to be requested to the project maintainer: [Michaël Minelli](mailto:dojo@minelli.me).**
### How to modify the environment variables
You can modify environment variables in `.env` files that you have previously decrypted.
You also need to re-encrypt the modified `.env` files to store them in the `.env.vault` with the following command:
```bash
$ npm run dotenv:build
```
## Database
For the development, you can use the docker-compose file in the `Resources/DevInfra/` folder.
For the development, you can use the docker compose file in the `Resources/DevInfra/` folder.
The following command have to be executed in the base directory of the repository:
```bash
docker compose -f Resources/DevInfra/docker-compose.yml up -d
$ docker compose -f Resources/DevInfra/docker-compose.yml up -d
```
This will run a MariaDB database on port `59231` with the following credentials: `root:9buz7f312479g6234f1gnioubervw79b8z`
@@ -95,10 +115,11 @@ A second container is created with the Adminer tool on port `62394`.
#### Structure creation and seeding
The following command will create the database structure and seed it with some example data.
The following command (to be executed from the `ExpressAPI` folder) will create the database structure and seed it with
some example data.
```bash
npm run database:deploy:dev
$ npm run database:deploy:dev
```
Loading