Skip to main content

Environment variables

Available variables

General variables

Variable nameTypeDefault valueDescription
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_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_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_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 (,).
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 valueDescription
MOSPARO_ENABLE_WEBSERVERBoolean1Enables or disables the web server in the mosparo image.
MOSPARO_ENABLE_CRONBoolean1Enables or disables the cron jobs 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.