Configurazione Microservizi e Segreti
Questa pagina documenta tutte le variabili d'ambiente e i segreti utilizzati dai microservizi della piattaforma Visla.
Variabili d'Ambiente
Variabili Comuni
Queste variabili sono condivise dalla maggior parte dei servizi per la configurazione dell'infrastruttura di base.
| Variabile | Descrizione | Servizi Utilizzatori |
|---|---|---|
ENVIRONMENT | Ambiente di esecuzione (dev, prod, test). Controlla modalità debug e livelli log. | Tutti |
DATABASE_HOST | Hostname del database PostgreSQL. | Auth, Devices, Sharing, Positions, Events, Commands, Geofences, Notifications, Billing |
DATABASE_PORT | Porta del database PostgreSQL (default: 5432). | Auth, Devices, Sharing, Positions, Events, Commands, Geofences, Notifications, Billing |
DATABASE_USER | Username del database (spesso coincide con il nome del servizio). | Auth, Devices, Sharing, Positions, Events, Commands, Geofences, Notifications, Billing |
DATABASE_NAME | Nome del database (spesso coincide con il nome del servizio). | Auth, Devices, Sharing, Positions, Events, Commands, Geofences, Notifications, Billing |
REDIS_URL / REDIS_URI | URL di connessione a Redis (es. redis://redis:6379). | Auth, Devices, Events, Positions, Websocket, Billing, Decoder, Notifications, Commands |
AUTH_SERVICE_URL | URL interno del servizio Auth per validazione token e chiamate S2S. | Sharing, Devices, Positions, Events, Commands, Websocket, Geofences, Notifications, Billing |
DEVICES_SERVICE_URL | URL interno del servizio Devices per lookup dispositivi. | Websocket, Positions, Events, Geofences, Notifications, Simulator |
LOKI_URL | Endpoint per l'invio dei log a Grafana Loki. | Devices, Client-Logs, Decoder, Websocket, Device-Simulator |
LOKI_USERNAME | Username basic auth per Loki (Tenant ID). | Devices, Client-Logs, Decoder, Websocket, Device-Simulator |
LOKI_PASSWORD | Password basic auth per Loki (API Key). | Devices, Client-Logs, Decoder, Websocket, Device-Simulator |
Variabili Specifiche per Servizio
| Servizio | Variabile | Descrizione |
|---|---|---|
| Auth | API_BASE_URL | URL pubblico delle API per le callback OAuth. |
FRONTEND_URL / WEB_URL | URL della web app per i redirect post-login. | |
OPENID_GOOGLE_* | Client ID e settings per Login Google. | |
OPENID_FACEBOOK_* | Client ID e settings per Login Facebook. | |
OPENID_APPLE_* | Client ID e settings per Login Apple. | |
EMAIL_SMTP / PORT | Host e porta server SMTP. | |
EMAIL_USER / FROM_* | Credenziali e mittente email. | |
ACCESS_TOKEN_EXPIRATION_MINUTES | Durata dei token JWT (default: 7 giorni). | |
| Sharing | SHARE_TOKEN_EXPIRATION_DAYS | Durata di default dei link di condivisione. |
NOTIFICATION_SERVICE_URL | URL servizio notifiche per invio email condivisione. | |
| Positions | INPUT_STREAM | Stream Redis da cui leggere posizioni raw (es. positions:raw). |
OUTPUT_STREAM | Stream Redis dove scrivere posizioni validate (es. positions:validated). | |
REJECTED_STREAM | Stream per posizioni scartate. | |
FILTER_MAX_SPEED_KNOTS | Velocità massima per filtro scarto (default: 162 nodi). | |
FILTER_MAX_HDOP | HDOP massimo accettabile. | |
MOTION_SPEED_THRESHOLD_KNOTS | Soglia per considerare il dispositivo in movimento. | |
| Events | INPUT_STREAM | Stream Redis da monitorare per generazione eventi. |
OVERSPEED_THRESHOLD_KNOTS | Soglia di velocità per evento eccesso velocità. | |
| Notifications | FIREBASE_PROJECT_ID | ID progetto Firebase per notifiche push. |
BLAND_API_URL / KEY | Configurazioni per chiamate vocali Bland AI. | |
EMAIL_EVENTS_FROM_* | Mittente specifico per email di allarme/evento. | |
| Billing | STRIPE_API_KEY | Chiave API segreta Stripe. |
STRIPE_WEBHOOK_SECRET | Segreto per validazione webhook Stripe. | |
APPLE_SHARED_SECRET | Segreto condiviso per validazione ricevute Apple. | |
BUNDLE_ID | Bundle ID app iOS. | |
GOOGLE_PACKAGE_NAME | Package name app Android. | |
| Decoder | DECODER_PORT | Porta principale del servizio (Health/Actuator). |
*_PORT (es. S21L_PORT) | Porte TCP/UDP specifiche per ascolto protocolli GPS. | |
DECODER_TIMEOUT | Timeout in secondi per chiusura connessioni inattive. | |
| Device Sim | DEVICES_API_URL | URL API Devices per sincronizzazione device di test. |
DECODER_HOST | Hostname del decoder verso cui inviare traffico simulato. | |
| Websocket | *_STREAM | Nomi stream Redis da cui ricevere aggiornamenti real-time. |
| Client-Logs | LOKI_TOKEN | Token Bearer alternativo per autenticazione Loki (opzionale). |
Gestione Segreti (Docker Secrets)
I dati sensibili non vengono passati come variabili d'ambiente ma montati come file tramite Docker Secrets in /run/secrets/. Il file docker-compose.yml mappa questi segreti dai file locali in ./secrets/.
| Nome Secret (Docker) | File Sorgente (./secrets/) | Utilizzato da | Descrizione |
|---|---|---|---|
secret_key | secret_key | Auth, Websocket | Chiave privata maestra per firma token JWT. |
auth_db_password | auth_db_password | Postgres, Auth | Password database Auth. |
devices_db_password | devices_db_password | Postgres, Devices | Password database Devices. |
sharing_db_password | sharing_db_password | Postgres, Sharing | Password database Sharing. |
positions_db_password | positions_db_password | Postgres, Positions | Password database Positions. |
events_db_password | events_db_password | Postgres, Events | Password database Events. |
commands_db_password | commands_db_password | Postgres, Commands | Password database Commands. |
geofences_db_password | geofences_db_password | Postgres, Geofences | Password database Geofences. |
notifications_db_password | notification_db_password | Postgres, Notifications | Password database Notifications. |
billing_db_password | billing_db_password | Postgres, Billing | Password database Billing. |
google_client_secret | google_client_secret | Auth | Secret OAuth2 Google Login. |
facebook_client_secret | facebook_client_secret | Auth | Secret OAuth2 Facebook Login. |
apple_private_key | apple_private_key | Auth | Chiave privata Sign in with Apple. |
email_password | email_password | Auth, Notifications | Password SMTP per invio email. |
default_admin_password | default_admin_password | Auth | Password per utente admin di default creato al boot. |
firebase_service_account | firebase_service_account.json | Notifications | Credenziali JSON Service Account Firebase. |
bland_api_key | bland_api_key | Notifications | API Key per servizio chiamate vocali Bland AI. |
stripe_api_key | stripe_api_key | Billing | Chiave Segreta Stripe. |
stripe_webhook_secret | stripe_webhook_secret | Billing | Secret verifica webhook Stripe. |
apple_shared_secret | apple_shared_secret | Billing | Shared Secret per verifica abbonamenti Apple. |
google_service_account_billing | google_service_account_billing.json | Billing | Credenziali JSON Google Play Developer API. |
1nce_credentials | 1nce_credentials | Commands | Credenziali API 1NCE per gestione SIM. |
openvpn_credentials | openvpn_credentials.txt | OpenVPN-Client | Username/Password per connessione VPN 1NCE. |
openvpn_config | openvpn_config.conf | OpenVPN-Client | File configurazione CLIENT OpenVPN. |