Skip to main content

Configuration

Complete reference for the environment variables and settings of the ION Guard platform.

The .env file​

The .env file is generated automatically during installation. It contains all application settings and must never be committed to version control.

Location: /home/iongrade/ionguard/.env

After editing .env, apply the changes:

cd /home/iongrade/ionguard

# Recreate containers with the new variables
./scripts/comp.sh up -d --force-recreate ionguard_php

# Clear the configuration cache
./scripts/comp.sh exec -T ionguard_php php artisan config:clear

Deployment​

VariableDefaultDescription
IONGUARD_DEPLOY—Deployment hostname
FACILITY—Customer/facility identifier
DEPLOY_MODEsaasDeployment mode: saas or onpremises
VIRTUAL_HOST—Virtual hostname (used by the reverse proxy)

Network​

VariableDefaultDescription
HOST_IP(auto)Host IP. Auto-detected by detectHostIp.sh on every startup. Override if the machine has multiple interfaces
MQTT_EXTERNAL_HOST(auto)IP/hostname that antennas and gateways use to connect to MQTT. Auto-set as HOST_IP. Override if behind NAT or a load balancer

Application​

VariableDefaultDescription
APP_NAMEIonGuardApplication name
APP_ENVproductionEnvironment: production, local, testing
APP_KEY(generated)Application encryption key (base64)
APP_DEBUGfalseDebug mode. Never true in production
APP_URLhttps://{HOST}Application base URL
APP_LOCALEenDefault language (set pt_BR for Portuguese)
APP_FALLBACK_LOCALEenFallback language
BCRYPT_ROUNDS12Bcrypt rounds for password hashing

Logging​

VariableDefaultDescription
LOG_CHANNELstackMain log channel
LOG_STACKdailyStack type: daily rotation
LOG_LEVELdebugMinimum level: debug, info, notice, warning, error, critical

Database (MariaDB)​

VariableDefaultDescription
DB_CONNECTIONmariadbConnection driver
DB_HOSTionguard_mariadb_{HOST}MariaDB container hostname
DB_PORT3306MariaDB port
DB_DATABASEionguardDatabase name
DB_USERNAMEionguardDatabase user
DB_PASSWORD(generated)Database password
DATABASE_EXPOSE_PORT(empty)Port to expose MariaDB on the host. Leave empty in production

Cache, Queues, and Sessions (Redis/Valkey)​

VariableDefaultDescription
CACHE_STOREredisCache driver
QUEUE_CONNECTIONredisQueue driver
SESSION_DRIVERdatabaseSession driver
SESSION_LIFETIME120Session lifetime in minutes
SESSION_ENCRYPTtrueEncrypts session data
SESSION_SECURE_COOKIEtrueSession cookie over HTTPS only
REDIS_HOSTionguard_valkey_{HOST}Valkey container hostname
REDIS_PORT6379Redis port
REDIS_PASSWORDnullRedis password (null = no password)

WebSocket (Reverb)​

VariableDefaultDescription
BROADCAST_CONNECTIONreverbBroadcasting driver
REVERB_APP_ID(generated)Reverb application ID
REVERB_APP_KEY(generated)Reverb public key
REVERB_APP_SECRET(generated)Reverb secret key
REVERB_HOSTionguard_reverb_{HOST}Reverb container hostname
REVERB_PORT8080WebSocket server port
Note

The frontend automatically derives the WebSocket host/port/scheme from window.location at runtime. There is no need to configure VITE_REVERB_* variables.

MQTT​

VariableDefaultDescription
MQTT_ENABLEDtrueEnable MQTT integration
MQTT_HOSTionguard_mosquitto_{HOST}Mosquitto broker hostname
MQTT_PORT8883MQTT port (8883 = TLS, default; 1883 only for dev broker without TLS)
MQTT_CLIENT_IDionguard-listenerMQTT client ID
MQTT_USERNAMElistenerMQTT user
MQTT_PASSWORD(generated)MQTT password
MQTT_TOPIC_PREFIXionguardMQTT topic prefix
MQTT_KEEP_ALIVE60MQTT connection keep-alive interval (seconds)
MQTT_QOS1Quality of service for MQTT messages
MQTT_EXTERNAL_HOST(auto)Host that devices use to connect (auto-detected; see the Network section)
MQTT_EXTERNAL_PORT8883MQTT port that devices use (device-facing). See the caution below
MQTT_WEBSOCKET_PORT9001MQTT WebSocket port exposed on the host

MQTT broker TLS​

VariableDefaultDescription
MQTT_TLS_ENABLEDtrueTLS enabled by default (fail-closed): with MQTT active and no explicit flag, the connection is made with TLS
MQTT_TLS_CA_FILE—CA file with which the broker certificate was signed
MQTT_TLS_VERIFY_PEERtrueVerifies the broker certificate
MQTT over TLS by default (8883)

In recent versions, device communication (antennas/gateways) with the broker uses TLS on port 8883 by default — devices must connect via TLS. Port 1883 (plaintext) is reserved for an isolated development broker. When configuring the firewall and MQTT_EXTERNAL_PORT, align the port with the mode of your deployment.

InfluxDB (Time-Series)​

VariableDefaultDescription
INFLUXDB_ENABLEDtrueEnable InfluxDB for BLE signals
INFLUXDB_URLhttp://ionguard_influxdb_{HOST}:8086InfluxDB URL
INFLUXDB_TOKEN(generated)Authentication token
INFLUXDB_ORGiongradeOrganization in InfluxDB
INFLUXDB_BUCKETionguardStorage bucket

Modules​

VariableDefaultDescription
MODULE_ENCRYPTION_KEY(generated)Key for encrypting sensitive module data (gateway credentials, tokens). Randomly generated per installation
Important

The MODULE_ENCRYPTION_KEY is different from the release key used to package .enc modules. This key is unique per installation and protects data at runtime.

Data retention​

VariableDefaultDescription
RETENTION_SIGNALS_DAYS7Retention days for BLE signals. Applied through the InfluxDB bucket retention policy (set on container startup)
RETENTION_LOCATIONS_DAYS90Retention days for location history (MariaDB)
RETENTION_EVENTS_DAYS365Retention days for events
RETENTION_AUDIT_DAYS365Retention days for audit logs
RETENTION_BATCH_SIZE10000Batch size for data cleanup
Where each retention is applied

Location, event, and audit retentions are cleanup jobs that run against MariaDB (config/retention.php). BLE signal retention is applied directly by the InfluxDB bucket retention policy.

Email​

VariableDefaultDescription
MAIL_MAILERsmtpEmail driver
MAIL_HOST—SMTP server
MAIL_PORT587SMTP port
MAIL_USERNAME—SMTP user
MAIL_PASSWORD—SMTP password
MAIL_FROM_ADDRESS—Sender address

Performance​

VariableDefaultDescription
PHP_FPM_WORKERS50Maximum number of PHP-FPM workers. Adjust according to available RAM
TZAmerica/Sao_PauloSystem timezone

API (Sanctum tokens)​

VariableDefaultDescription
SANCTUM_TOKEN_EXPIRATION1440API token validity in minutes (1440 = 24 h)
SANCTUM_TOKEN_PREFIXionguard_Prefix of the issued API tokens

Ports (on-premises)​

VariableDefaultDescription
HTTP_PORT80HTTP port on the host
HTTPS_PORT443HTTPS port on the host
Multiple applications on the same host

If the server already hosts another application on ports 80/443, change to alternative ports (e.g., HTTP_PORT=8080, HTTPS_PORT=8443).


Application settings​

Besides .env, there are PHP configuration files in app/config/ that control specific behaviors:

Location Engine (config/location.php)​

Parameters for the BLE location engine (all overridable via .env):

VariableDefaultDescription
LOCATION_WINDOW_SIZE15Window (seconds) for collecting signals for the calculation
LOCATION_CALCULATION_INTERVAL5Interval (seconds) between location calculations
LOCATION_MIN_SIGNALS2Minimum signals required to position a beacon
LOCATION_RSSI_THRESHOLD_MINIMUM-90Minimum RSSI (dBm) considered for zone detection
LOCATION_HYSTERESIS_THRESHOLD5Hysteresis (dB) to avoid oscillation between zones
LOCATION_KEEP_ALIVE_TIMEOUT120Time (seconds) without a signal to mark a device as offline
LOCATION_BATTERY_LOW_THRESHOLD20Battery percentage that triggers a low-battery alert
LOCATION_ESCALATION_TIMEOUT120Time (seconds) for location-related escalation

Alerts (config/alerts.php)​

ParameterDefaultDescription
escalation.check_interval30Interval (seconds) of the job that checks alerts to escalate

Retention (config/retention.php)​

Data retention policies (also configurable via .env).

Modules (config/modules.php)​

  • Release key for module decryption
  • Module directory
  • Loading configuration