60 lines
No EOL
1.3 KiB
Markdown
60 lines
No EOL
1.3 KiB
Markdown
# User api management
|
|
|
|
The purpose to this project is permit the auth, register and settings of users.
|
|
|
|
This project is exclusevli develop in go, and validation lib are provided for go only.
|
|
|
|
Has this project is in H6N global project his requirement will first meet H6N needs.
|
|
|
|
## Version
|
|
|
|
v1.2.0: Helium
|
|
|
|
## Developpement
|
|
|
|
- Golang
|
|
- Docker
|
|
|
|
### generate swagger
|
|
|
|
```bash
|
|
swag init --parseInternal --generalInfo ./cmd/main.go --output ./cmd/docs/
|
|
```
|
|
|
|
### with docker compose
|
|
|
|
```bash
|
|
cat <<ENDFILE > docker-compose.yml
|
|
version: '3.1'
|
|
|
|
services:
|
|
postgres:
|
|
image: postgres:15.2-alpine3.17
|
|
restart: unless-stopped
|
|
environment:
|
|
POSTGRES_USER: 'acc'
|
|
POSTGRES_PASSWORD: 'totor'
|
|
POSTGRES_DB: 'accounts'
|
|
healthcheck:
|
|
test: ["CMD-SHELL", "pg_isready"]
|
|
interval: 10s
|
|
timeout: 5s
|
|
retries: 5
|
|
users:
|
|
build:
|
|
context: .
|
|
target: develop
|
|
ports:
|
|
- 127.0.0.1:2300:1222
|
|
volumes:
|
|
- .:/app:ro
|
|
- ./docker/keys:/keys
|
|
depends_on:
|
|
postgres:
|
|
condition: service_healthy
|
|
ENDFILE
|
|
|
|
cat config/db.sql| docker compose exec -T postgres psql -U acc accounts
|
|
|
|
curl -s http://127.0.0.1:2300/ -H "Content-Type: application/json" -d "{\"username\":\"root@root.fr\",\"password\":\"root\"}" | jq -r '.token'
|
|
``` |