From ae099f04cf827df0c286f0ee7f755d6738041199 Mon Sep 17 00:00:00 2001 From: Stefano Date: Sun, 8 Feb 2026 17:31:32 +0100 Subject: [PATCH] fixing --- .env.prod | 78 +++++++++++++++++++++++++++++++++++++++++ .gitignore | 1 - README.md | 13 +------ compose.yml | 6 ++-- frontend/css/styles.css | 2 +- 5 files changed, 83 insertions(+), 17 deletions(-) create mode 100644 .env.prod diff --git a/.env.prod b/.env.prod new file mode 100644 index 0000000..ce78d41 --- /dev/null +++ b/.env.prod @@ -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 diff --git a/.gitignore b/.gitignore index aa6ad52..c4d5ae4 100644 --- a/.gitignore +++ b/.gitignore @@ -25,7 +25,6 @@ ENV/ # Environment variables .env .env.local -.env.production # IDE .idea/ diff --git a/README.md b/README.md index 8f603f6..eb8d8f9 100644 --- a/README.md +++ b/README.md @@ -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 diff --git a/compose.yml b/compose.yml index 28d6289..db9b882 100644 --- a/compose.yml +++ b/compose.yml @@ -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 \ No newline at end of file + external: true diff --git a/frontend/css/styles.css b/frontend/css/styles.css index a77af61..421d002 100644 --- a/frontend/css/styles.css +++ b/frontend/css/styles.css @@ -13,7 +13,7 @@ --success: #16a34a; --success-bg: #dcfce7; --warning: #f59e0b; - --warning-bg: #fef3c7; + --warning-bg: #fde68a; --danger: #dc2626; --danger-bg: #fee2e2; --text: #1f1f1f;