Add docs tab with local READMEs and login form to monitoring UI
Build and Push Docker Images / detect-changes (pull_request) Successful in 13s
Build and Push Docker Images / build-transit-api (pull_request) Has been skipped
Build and Push Docker Images / build-monitoring-ui (pull_request) Has been skipped
Build and Push Docker Images / deploy-test-node (pull_request) Has been skipped
Build and Push Docker Images / build-employee-api (pull_request) Has been skipped
Build and Push Docker Images / build-auth-api (pull_request) Has been skipped
Build and Push Docker Images / build-error-log-api (pull_request) Has been skipped
Build and Push Docker Images / build-admin-ui (pull_request) Has been skipped
Build and Push Docker Images / detect-changes (push) Successful in 9s
Build and Push Docker Images / build-auth-api (push) Successful in 1m0s
Build and Push Docker Images / build-employee-api (push) Successful in 59s
Build and Push Docker Images / build-transit-api (push) Successful in 57s
Build and Push Docker Images / build-error-log-api (push) Successful in 1m4s
Build and Push Docker Images / build-admin-ui (push) Successful in 1m17s
Build and Push Docker Images / build-monitoring-ui (push) Successful in 1m14s
Build and Push Docker Images / deploy-test-node (push) Successful in 3s
Build and Push Docker Images / detect-changes (pull_request) Successful in 13s
Build and Push Docker Images / build-transit-api (pull_request) Has been skipped
Build and Push Docker Images / build-monitoring-ui (pull_request) Has been skipped
Build and Push Docker Images / deploy-test-node (pull_request) Has been skipped
Build and Push Docker Images / build-employee-api (pull_request) Has been skipped
Build and Push Docker Images / build-auth-api (pull_request) Has been skipped
Build and Push Docker Images / build-error-log-api (pull_request) Has been skipped
Build and Push Docker Images / build-admin-ui (pull_request) Has been skipped
Build and Push Docker Images / detect-changes (push) Successful in 9s
Build and Push Docker Images / build-auth-api (push) Successful in 1m0s
Build and Push Docker Images / build-employee-api (push) Successful in 59s
Build and Push Docker Images / build-transit-api (push) Successful in 57s
Build and Push Docker Images / build-error-log-api (push) Successful in 1m4s
Build and Push Docker Images / build-admin-ui (push) Successful in 1m17s
Build and Push Docker Images / build-monitoring-ui (push) Successful in 1m14s
Build and Push Docker Images / deploy-test-node (push) Successful in 3s
This commit is contained in:
@@ -0,0 +1,47 @@
|
||||
# Auth API
|
||||
|
||||
Authentication service for XTransit. Handles login, JWT token generation, and user verification.
|
||||
|
||||
## Setup
|
||||
|
||||
### Environment Variables
|
||||
|
||||
```env
|
||||
PG_HOST=localhost
|
||||
PG_PORT=5432
|
||||
PG_USER=your_user
|
||||
PG_PASS=your_password
|
||||
PG_DB=your_database
|
||||
JWT_SECRET=your_jwt_secret
|
||||
PORT=5000
|
||||
ADMIN_USER_CODES=1234,5678
|
||||
DEV_BYPASS=0
|
||||
ERROR_LOG_API_URL=https://error.xtransit.testinstance.nl/error_log
|
||||
```
|
||||
|
||||
### Start API
|
||||
|
||||
```bash
|
||||
npm start
|
||||
```
|
||||
|
||||
Runs at `https://auth.xtransit.testinstance.nl`
|
||||
|
||||
## API Endpoints
|
||||
|
||||
**POST** `/login`
|
||||
- Body: `{ "userCode": 1234, "password": "secret" }`
|
||||
- Returns: `{ "token": "jwt...", "user": { "id": 1, "userCode": 1234, "job": "driver", "isAdmin": false } }`
|
||||
|
||||
**GET** `/me`
|
||||
- Requires: `Authorization: Bearer <token>`
|
||||
- Returns: `{ "user": { "userId": 1, "userCode": 1234, "isAdmin": false } }`
|
||||
|
||||
**GET** `/health`
|
||||
- Returns: `{ "status": "ok", "service": "auth_api" }`
|
||||
|
||||
## Database
|
||||
|
||||
Uses `workers.users` table with columns: `id`, `usercode`, `password` (bcrypt), `job`
|
||||
|
||||
Admin status is determined by `ADMIN_USER_CODES` env variable (comma-separated user codes).
|
||||
Reference in New Issue
Block a user