73 lines
1.4 KiB
Markdown
73 lines
1.4 KiB
Markdown
## Install dependencies
|
|
|
|
### Install node and npm
|
|
|
|
You'll need node v6+, here's a link to install it:
|
|
https://nodejs.org/en/download/package-manager/#debian-and-ubuntu-based-linux-distributions
|
|
|
|
## Dev
|
|
|
|
#### Check your config.yml file
|
|
|
|
#### Setup your database
|
|
|
|
Install your own database or spawn one in a docker
|
|
|
|
```sh
|
|
./dev.sh docker-db up -d
|
|
```
|
|
|
|
#### Run the backend
|
|
|
|
```sh
|
|
./dev.sh back
|
|
```
|
|
|
|
In case of custom database, launch the backend with DB_USER, DB_PASS,
|
|
DB_DATABASE, DB_HOST, DB_PORT, or directly the full DSN in DB_DSN_DEV
|
|
|
|
```sh
|
|
DB_DSN_DEV="postgres://test:test@127.0.0.1:5432/dev?sslmode=disable" ./dev.sh back
|
|
```
|
|
|
|
#### Run the frontend
|
|
|
|
```sh
|
|
./dev.sh front
|
|
```
|
|
|
|
## Connect to the database
|
|
|
|
```sh
|
|
docker run -it --rm -e PGPASSWORD=test --link canape_postgresql_dev:postgres postgres:13.1 psql -h postgres -U test -d dev
|
|
```
|
|
|
|
## Setup the dev users
|
|
|
|
Connect to the database and enter this sql queries:
|
|
|
|
```sh
|
|
INSERT INTO users (name, hash, admin, activated) VALUES ('test', '$2a$10$QHx07iyuxO1RcehgtjMgjOzv03Bx2eeSKvsxkoj9oR2NJ4cklh6ue', false, true);
|
|
INSERT INTO users (name, hash, admin, activated) VALUES ('admin', '$2a$10$qAbyDZsHtcnhXhjhQZkD2uKlX72eMHsX8Hi2Cnl1vJUqHQiey2qa6', true, true);
|
|
```
|
|
|
|
This users are defined with this parameters:
|
|
pepper: "pepper"
|
|
cost: 10
|
|
|
|
Users:
|
|
* Admin user: admin / admin
|
|
* Test user: test / test
|
|
|
|
## Init the database
|
|
|
|
```sh
|
|
./dev.sh db-init
|
|
```
|
|
|
|
## Run the tests
|
|
|
|
```sh
|
|
go test ./...
|
|
```
|