Skip to main content

Environment variables

Available variables

General variables

Variable nameTypeDefault valueDescription
MOSPARO_CONFIG_FILE_PATHStringemptyIf you want to use a specific file as a configuration file, configure the following environment variable and set it to the path of your configuration file. The path has to be absolute.
DATABASE_MYSQL_SSLBoolean0Defines if the MySQL connection should be encrypted. 1 to enable the encrypted connection.
DATABASE_MYSQL_SSL_KEYStringemptyDefines the file path to the SSL key.
DATABASE_MYSQL_SSL_CERTStringemptyDefines the file path to the SSL certificate.
DATABASE_MYSQL_SSL_CAStringemptyDefines the file path to the certificate authority.
DATABASE_MYSQL_SSL_VERIFY_SERVER_CERTBoolean0Defines if the server certificate should be verified. 1 to verify the certificate.
MOSPARO_UPDATES_ENABLEDBoolean1Enables or disables the option to update mosparo within the user interface.
MOSPARO_AUTOMATIC_UPDATE_CHECK_ENABLEDBoolean1Enables or disables the automatic check for a new version when accessing the user interface.
MOSPARO_ENV_SUFFIXStringemptyWith the suffix, it's possible to adjust the mosparo configuration file name.
MOSPARO_CACHE_ADAPTERStringfilesystemThis sets the adapter for the shared cache. The shared cache helps share cache data between multiple nodes. Available options: filesystem, memcached, redis
MOSPARO_PREPARE_CSS_FILES_IN_SHARED_CACHEBoolean0If enabled, mosparo will store the prepared CSS files in the shared cache instead of in a physical file on your server. This is useful if you use multiple nodes for mosparo since you do not have to synchronize the files between your nodes.
MOSPARO_USE_SHARED_CACHE_FOR_RULE_ITEMSBoolean0To optimize the validation process, it can be helpful to cache the matching rule items for a value in the shared cache. Depending on the number of rules, storing rule items can significantly increase the validation process. The rule items are stored depending on the value of the field. If the same value is validated again, the rule items are loaded from the shared cache.
MOSPARO_RULE_ITEMS_CACHE_TTLInteger3600We do not store the keys of the cache items. Because of this, we cannot clean the cache when a rule item gets changed. It's essential to set the TTL to a suitable value. If the TTL is too large, you must wait too long after changing a rule item, or you must manually clear the cache. If the TTL is too short, the cache cannot give you any benefit. While optimizing the rules, we suggest using a maximum TTL of 3600 seconds. When you do not change the rule items frequently, you can set the TTL to a day (86400 seconds) or any other value you prefer.
MOSPARO_CLEANUP_GRACE_PERIOD_ENABLEDBoolean0When enabled, the frontend API controller of mosparo will not clean up the database for another 24 hours. This is helpful if you use a cronjob to clean up the database every night. If so, you do not want to let the frontend API controller do this job. For this, you can enable the grace period, meaning the frontend API controller will wait another 24 hours before the cleanup starts. In these 24 hours, the cronjob can clean the database again, so the frontend API controller will technically never clean up the database, except if the cronjob was not executed successfully.
MOSPARO_SUBMIT_TOKEN_RETENTION_PERIODInteger24Defines the number of hours after which an unused submit token or an unverified submission is deleted from the database. The value is at least 1 hour and a maximum of 24 hours.
MOSPARO_SUBMISSION_RETENTION_PERIODInteger14Defines the number of days after which a verified or spam-identified submission is deleted from the database. The value is at least 1 day and a maximum of 14 days.
MOSPARO_CLEANUP_PROCESS_INTERVALInteger6Defines the cleanup interval at which the regular cleanup is executed. The interval is at least 1 hour and a maximum of 24 hours.
MOSPARO_CLEANUP_UNFINISHED_INTERVALInteger10Defines the interval at which a cleanup will be scheduled if the previous cleanup was not finished. The interval is at least 1 minute and a maximum of 360 minutes.
MOSPARO_BYPASS_HEALTH_CHECKBoolean0If getting a positive response from the health check is required, you can enable this environment variable to bypass the health check. This can be useful if the Docker container is always unhealthy, and it's required to start the container without the health check.
MOSPARO_HEALTH_ALLOW_LISTString127.0.0.1,::1Only IP addresses listed in this environment variable can access the health API. By default, only the localhost can access the health check. You can add IP addresses (for example, 10.11.12.13) or subnets with the subnet mask in CIDR notation (for example, 10.11.12.0/24), separated by a comma (,).
FILESYSTEM_CACHE_PATHStringemptyThis environment variable defines the path to the filesystem cache for the shared cache. The shared cache will be stored in the system's temporary directory if the variable is empty. If you want to store the shared cache in a specific directory, specify the absolute path to that directory with this environment variable.
MEMCACHED_URLStringmemcached://localhostConnection details to connect to your memcached cache. Has no effect as long as MOSPARO_CACHE_ADAPTER is not set to memcached. Find configuration examples in the Symfony documentation.
REDIS_URLStringredis://localhostConnection details to connect to your Redis cache. Has no effect as long as MOSPARO_CACHE_ADAPTER is not set to redis. Find configuration examples in the Symfony documentation.
TRUSTED_PROXIESString127.0.0.1If you deploy mosparo behind a load balancer or any other kind of reverse proxy, mosparo does not know the real IP address of the user. For this, your reverse proxy will send special headers to mosparo (for example, X-Forwarded-For). But mosparo (and Symfony in general) will accept these headers only from the trusted proxies. For this, you have to list the IP addresses of your reverse proxies in this variable so mosparo knows which ones it can trust. You can add IP addresses (for example, 10.11.12.13) or subnets with the subnet mask in CIDR notation (for example, 10.11.12.0/24), separated by a comma (,). You can add REMOTE_ADDR to accept all clients, but you should make sure that only your reverse proxies can access your web server.

Docker-specific variables

Variable nameTypeDefault valueImageDescription
MOSPARO_ENABLE_WEBSERVERBoolean1StandardEnables or disables the web server in the mosparo image.
MOSPARO_ENABLE_CRONBoolean1StandardEnables or disables the cron jobs in the mosparo image.
MOSPARO_RUN_NGINXBoolean1UnprivilegedEnables or disables the nginx Webserver in the mosparo image.
MOSPARO_RUN_PHP_FPMBoolean1UnprivilegedEnables or disables the PHP FPM in the mosparo image.

Configuration

.env.local file

For a normal installation (not a Docker-based one), the recommended approach to configuring these environment variables is to create a new file named .env.local and add the required environment variables with the needed values to it.

Copy the file .env.local.dist and adjust the values for an easier start. The file contains all the possible variables and describes how to use them.

Docker

Docker Compose

If you use Docker Compose to configure the containers, set the environment variables in the Docker Compose file.

  ...
mosparo_web:
image: mosparo/mosparo:latest
ports:
- 8080:80
restart: always
environment:
- MOSPARO_ENABLE_WEBSERVER=1
- MOSPARO_CLEANUP_GRACE_PERIOD_ENABLED=1
- MOSPARO_CACHE_ADAPTER=memcached
- MEMCACHED_URL=memcached://memcached
...

Docker directly

When starting a Docker container via the command line, you can specify the environment variables as an argument:

docker run -d -e MOSPARO_CACHE_ADAPTER='memcached' -p 8080:80 --name mosparo_container mosparo/mosparo:latest

Learn more about this in the Docker documentation.

Other options

You can probably also specify the environment variables in your webserver configuration (depending on your webserver). For this, check your webserver's documentation.