Compare commits

..

1 Commits

Author SHA1 Message Date
ae099f04cf fixing 2026-02-08 17:31:32 +01:00
5 changed files with 83 additions and 17 deletions

78
.env.prod Normal file
View File

@@ -0,0 +1,78 @@
# Parking Manager Configuration
# =============================================================================
# REQUIRED - Security
# =============================================================================
# MUST be set to a random string of at least 32 characters
# Generate with: openssl rand -hex 32
SECRET_KEY=766299d3235f79a2a9a35aafbc90bec7102f250dfe4aba83500b98e568289b7a
# =============================================================================
# Server
# =============================================================================
# Usa 0.0.0.0 per permettere connessioni dall'esterno del container (essenziale per Docker/Traefik)
HOST=0.0.0.0
PORT=8000
# Database (SQLite path)
# Percorso assoluto nel container
DATABASE_PATH=/app/data/parking.db
# Lascia vuoto DATABASE_URL per costruirlo automaticamente da DATABASE_PATH
# Oppure usa: DATABASE_URL=sqlite:////app/data/parking.db
# CORS (comma-separated origins)
#ALLOWED_ORIGINS=https://parking.rocketscale.it
# JWT token expiration (minutes, default 24 hours)
ACCESS_TOKEN_EXPIRE_MINUTES=1440
# Logging level (DEBUG, INFO, WARNING, ERROR)
LOG_LEVEL=INFO
# =============================================================================
# Rate Limiting
# =============================================================================
# Number of requests allowed per window for sensitive endpoints (login, register)
RATE_LIMIT_REQUESTS=5
# Window size in seconds
RATE_LIMIT_WINDOW=60
# =============================================================================
# Authentication
# =============================================================================
# Set to true when behind Authelia reverse proxy
AUTHELIA_ENABLED=true
# Header names (only change if your proxy uses different headers)
AUTHELIA_HEADER_USER=Remote-User
AUTHELIA_HEADER_NAME=Remote-Name
AUTHELIA_HEADER_EMAIL=Remote-Email
AUTHELIA_HEADER_GROUPS=Remote-Groups
# LLDAP group that maps to admin role
AUTHELIA_ADMIN_GROUP=parking_admins
# External URLs for Authelia mode (used for landing page buttons)
# Login URL - Authelia's login page (users are redirected here to authenticate)
AUTHELIA_LOGIN_URL=https://auth.rocketscale.it
# Registration URL - External registration portal (org-stack self-registration)
REGISTRATION_URL=https://register.rocketscale.it
# Logout URL
AUTHELIA_LOGOUT_URL=https://auth.rocketscale.it/logout
# =============================================================================
# Email Notifications
# =============================================================================
# Set to true to enable email sending
SMTP_ENABLED=false
# SMTP server configuration
SMTP_HOST=localhost
SMTP_PORT=587
SMTP_USER=
SMTP_PASSWORD=
SMTP_FROM=noreply@parking.local
SMTP_USE_TLS=true
# When SMTP is disabled, emails are logged to this file
EMAIL_LOG_FILE=/tmp/parking-emails.log

1
.gitignore vendored
View File

@@ -25,7 +25,6 @@ ENV/
# Environment variables
.env
.env.local
.env.production
# IDE
.idea/

View File

@@ -119,10 +119,6 @@ Gestione utenti e profili.
- `GET /me/settings`: Ottieni le proprie impostazioni.
- `PUT /me/settings`: Aggiorna le proprie impostazioni.
- `POST /me/change-password`: Modifica la propria password.
- `GET /me/exclusion`: Lista delle proprie auto-esclusioni.
- `POST /me/exclusion`: Crea una nuova auto-esclusione.
- `PUT /me/exclusion/{exclusion_id}`: Modifica una auto-esclusione.
- `DELETE /me/exclusion/{exclusion_id}`: Elimina una auto-esclusione.
### Offices (`/api/offices`)
Gestione uffici, regole di chiusura e quote.
@@ -155,8 +151,7 @@ Gestione presenze giornaliere.
- `POST /admin/mark`: Segna presenza per un altro utente (Manager/Admin).
- `DELETE /admin/{user_id}/{date}`: Rimuovi presenza di un altro utente (Manager/Admin).
- `GET /team`: Visualizza presenze e stato parcheggio del team.
- `GET /admin/{user_id}`: Storico presenze di un utente (Manager/Admin).
- `POST /admin/clear-office-presence`: Pulisce presenze e parcheggi di un ufficio per un range di date (Test/Admin).
- `GET /admin/{user_id}`: Storico presenze di un utente.
### Parking (`/api/parking`)
Gestione assegnazioni posti auto.
@@ -170,12 +165,6 @@ Gestione assegnazioni posti auto.
- `POST /reassign-spot`: Riassegna o libera un posto già assegnato.
- `POST /release-my-spot/{id}`: Rilascia il proprio posto assegnato.
- `GET /eligible-users/{id}`: Lista utenti idonei a ricevere un posto riassegnato.
- `POST /test-email`: Invia email di test (Test Tool).
### Reports (`/api/reports`)
Esportazione dati.
- `GET /team-export`: Esporta dati presenze e parcheggi del team in Excel.
## Utilizzo con AUTHELIA

View File

@@ -18,7 +18,7 @@ services:
- PORT=8000
- DATABASE_PATH=/app/data/parking.db
healthcheck:
test: ["CMD", "python", "-c", "import urllib.request; urllib.request.urlopen('http://localhost:8000/health')"]
test: [ "CMD", "python", "-c", "import urllib.request; urllib.request.urlopen('http://localhost:8000/health')" ]
interval: 30s
timeout: 10s
retries: 3
@@ -31,8 +31,8 @@ services:
- "caddy.forward_auth=authelia:9091"
- "caddy.forward_auth.uri=/api/verify?rd=https://parking.lvh.me/"
- "caddy.forward_auth.copy_headers=Remote-User Remote-Groups Remote-Name Remote-Email"
# cambiare l'url delle label per il reverse proxy
networks:
org-network:
external: true
external: true

View File

@@ -13,7 +13,7 @@
--success: #16a34a;
--success-bg: #dcfce7;
--warning: #f59e0b;
--warning-bg: #fef3c7;
--warning-bg: #fde68a;
--danger: #dc2626;
--danger-bg: #fee2e2;
--text: #1f1f1f;