refactor: update ADMIN_USER_CODES configuration; move to auth_api and clarify usage in documentation
Build and Push Docker Images / build-auth-api (push) Has been cancelled
Build and Push Docker Images / build-employee-api (push) Failing after 2m52s
Build and Push Docker Images / build-admin-ui (push) Failing after 24s
Build and Push Docker Images / build-transit-api (push) Failing after 26s
Build and Push Docker Images / build-error-log-api (push) Failing after 27s
Build and Push Docker Images / build-auth-api (push) Has been cancelled
Build and Push Docker Images / build-employee-api (push) Failing after 2m52s
Build and Push Docker Images / build-admin-ui (push) Failing after 24s
Build and Push Docker Images / build-transit-api (push) Failing after 26s
Build and Push Docker Images / build-error-log-api (push) Failing after 27s
This commit is contained in:
+1
-1
@@ -24,7 +24,7 @@ POSTGRES_PASSWORD_AUTH=your_password
|
|||||||
POSTGRES_USER_TRANSIT=transitAPI
|
POSTGRES_USER_TRANSIT=transitAPI
|
||||||
POSTGRES_PASSWORD_TRANSIT=your_password
|
POSTGRES_PASSWORD_TRANSIT=your_password
|
||||||
JWT_SECRET=your-secure-secret
|
JWT_SECRET=your-secure-secret
|
||||||
ADMIN_USER_CODES=42
|
# ADMIN_USER_CODES should be set in auth_api/.env (comma-separated admin user codes)
|
||||||
```
|
```
|
||||||
|
|
||||||
### Step 3: Start Services
|
### Step 3: Start Services
|
||||||
|
|||||||
@@ -370,10 +370,11 @@ Admin dashboard uses simple JWT-based authentication:
|
|||||||
2. Receive JWT token from `auth_api`
|
2. Receive JWT token from `auth_api`
|
||||||
3. Use token for admin operations (`/admin/*` endpoints)
|
3. Use token for admin operations (`/admin/*` endpoints)
|
||||||
|
|
||||||
Admin authorization is controlled by `ADMIN_USER_CODES` environment variable:
|
Admin authorization is controlled by `ADMIN_USER_CODES` environment variable configured in the `auth_api` service:
|
||||||
|
|
||||||
```bash
|
```bash
|
||||||
ADMIN_USER_CODES=42,101,205 # Comma-separated admin user codes
|
# Set admin user codes for the auth service (comma-separated)
|
||||||
|
ADMIN_USER_CODES=42,101,205
|
||||||
```
|
```
|
||||||
|
|
||||||
---
|
---
|
||||||
@@ -385,7 +386,8 @@ ADMIN_USER_CODES=42,101,205 # Comma-separated admin user codes
|
|||||||
Use `DEV_MOCK=1` to work without a database (in-memory mock storage):
|
Use `DEV_MOCK=1` to work without a database (in-memory mock storage):
|
||||||
|
|
||||||
```bash
|
```bash
|
||||||
ADMIN_USER_CODES=42 DEV_MOCK=1 JWT_SECRET=devsecret npm --prefix ./transit_api start
|
# For local development set admin codes on the auth_api and start services
|
||||||
|
ADMIN_USER_CODES=42 DEV_MOCK=1 JWT_SECRET=devsecret npm --prefix ./auth_api start
|
||||||
```
|
```
|
||||||
|
|
||||||
### Production Mode
|
### Production Mode
|
||||||
|
|||||||
+1
-1
@@ -134,7 +134,7 @@ All requests include JWT Bearer token for authentication.
|
|||||||
|
|
||||||
### Admin Authorization
|
### Admin Authorization
|
||||||
|
|
||||||
Users must have a `userCode` in their JWT that matches `ADMIN_USER_CODES` environment variable in the transit API to access admin endpoints.
|
Users must have a `userCode` in their JWT and, for admin access, the `isAdmin` flag set by the `auth_api` based on the `ADMIN_USER_CODES` environment variable.
|
||||||
|
|
||||||
### Production Setup
|
### Production Setup
|
||||||
|
|
||||||
|
|||||||
@@ -42,10 +42,11 @@ PG_USER=your_user
|
|||||||
PG_PASS=your_password
|
PG_PASS=your_password
|
||||||
PG_DB=your_database
|
PG_DB=your_database
|
||||||
JWT_SECRET=your_jwt_secret
|
JWT_SECRET=your_jwt_secret
|
||||||
ADMIN_USER_CODES=12345,67890
|
|
||||||
PORT=5001
|
PORT=5001
|
||||||
```
|
```
|
||||||
|
|
||||||
|
Note: `ADMIN_USER_CODES` has been moved to the `auth_api` service. Configure admin user codes in `auth_api/.env` as a comma-separated list.
|
||||||
|
|
||||||
### 4. API starten
|
### 4. API starten
|
||||||
|
|
||||||
```bash
|
```bash
|
||||||
|
|||||||
Reference in New Issue
Block a user