Skip to content

Configure environment

There are several application settings which can be changed via config variables. Some of them have defaults and some of them need to be modified, particularly those with required placeholders (marked with ⭐️ below). ​

Server basics

Variables marked with star ⭐️ need to be modified for production use.

Variable nameTypeDefaultDescription
MERGIN_BASE_URL⭐️stringDeployment URL where Mergin Maps is hosted.
COLLECT_STATISTICSBooleantrueWhether to send usage statistics for application improvements. For more information check this page section
CONTACT_EMAILstring``Email contact for application administrator.
SERVICE_IDstringDeployment UUID. Auto-generated on the first run.

Security settings (important for production use)🛡️

Security settings are important for production use.

Variable nameTypeDefaultDescription
BEARER_TOKEN_EXPIRATIONinteger43200Lifetime of authorisation bearer token in seconds. When expired, users need to log in again.
SECRET_KEY⭐️stringSecret key for authorisation, should be a generated strong string.
SECURITY_EMAIL_SALT⭐️stringToken salt for sending verification email, should be a generated strong string.
SECURITY_BEARER_SALT⭐️stringBearer token salt for decode web token, should be a generated strong string.
SECURITY_PASSWORD_SALT⭐️stringPassword salt for hashing, should be a generated strong string.
WTF_CSRF_ENABLEDBooleantrueEnable CSRF protection. It is strongly recommended to have this on.
WTF_CSRF_TIME_LIMITinteger86400Lifetime of CSRF token in seconds. When expired, users need to refresh it.

Database settings

Mergin Maps uses PostgreSQL database to store its data.

Variable nameTypeDefaultDescription
DB_APPLICATION_NAMEstringmerginComment in database connection string to better identify connection source.
DB_DATABASE ⭐️stringpostgresDatabase to store Mergin Maps tables.
DB_HOSTstringdbDatabase host. Mapped to docker-compose service name.
DB_PASSWORD ⭐️stringpostgresPostgreSQL user password.
DB_PORTinteger5432Database port. If non-default, it should match the port exposed in the docker-compose file.
DB_POOL_MAX_OVERFLOWinteger10Database max_overflow limit for SQLAlchemy.
DB_POOL_SIZEinteger2Database pool size for SQLAlchemy. With overflow determines the maximum of concurrent connections to the database.
DB_POOL_TIMEOUTinteger300Database pool timeout for SQLAlchemy.
DB_USER ⭐️stringpostgresPostgreSQL user to connect to Mergin Maps database.

User management

Settings for managing users.

Enterprise Edition only
Variable nameTypeDefaultDescription
USER_SELF_REGISTRATIONBooleantrueUsers can register themselves. If disabled, they must be invited or registered by superuser.
ENABLE_SUPERADMIN_ASSIGNMENTBooleantrueIf set to false, you will not be able to assign super admin role to user from admin panel.

Permission management

Community Edition only

To ease the process of permission (user) management, you can set the following global variables that apply to all registered users.

Variable nameTypeDefaultDescription
GLOBAL_ADMINBooleanfalseAll registered users can create/delete projects.
GLOBAL_READBooleanfalseAll registered users have read access to all projects. If false, the application admin would need to grant project access to users manually.
GLOBAL_WRITEBooleanfalseAll registered users have write access (can sync) to all projects.

Sending Emails

​Mergin Maps can connect to a SMTP server to send notifications and password recovery emails.

Variable nameTypeDefaultDescription
MAIL_SUPPRESS_SENDBooleanfalseWhether to suppress email sending. If set to false, you should define the following variables.
MAIL_DEFAULT_SENDER⭐️stringSender of Mergin Maps emails. Best to have some no-reply address.
MAIL_SERVER⭐️stringlocalhostSMTP mail server host.
MAIL_PORT⭐️integer587SMTP mail server port.
MAIL_USERNAMEstringNoneUsername of user connecting to SMTP server.
MAIL_PASSWORDstringNonePassword for user connecting to SMTP server.
MAIL_USE_TLS🛡️BooleantrueUse TLS encryption when connecting to SMTP server.
MAIL_USE_SSL🛡️BooleanfalseWhether to use SSL encryption when connecting to SMTP server.
MAIL_BCCstringNoneEmail address to send copies of all sent emails. Should be system/application administrator. Mandatory in versions until 2024.4.0.
MERGIN_LOGO_URLstring``Link to logo in emails.

If you have issues with sending emails, follow troubleshooting page.

Workspace management

Workspace settings.

Community Edition only
Variable nameTypeDefaultDescription
GLOBAL_WORKSPACE ⭐️stringmerginCommon workspace name for all projects. All projects belong to this single workspace with certain permissions. Projects are then referenced with this name as part of URL, e.g. /mergin/projectA, /mergin/projectB.
GLOBAL_STORAGE ⭐️integer10737418240Storage limit Mergin Maps can use to store projects (last version) in bytes (default is 10 GB). Should be reasonably large.
Enterprise Edition only
Variable nameTypeDefaultDescription
WORKSPACE_STORAGE_SIZE ⭐️integer524288000Storage limit workspace can use to store projects (last version) in bytes (default is 500 MB).
WORKSPACE_INVITATION_EXPIRATIONinteger14Expiration limit for pending invitation in days.
PROJECT_TRANSFER_EXPIRATIONinteger7Expiration limit for pending project transfer in days.
WORKSPACE_EXPIRATIONinteger7Expiration time in days for deleted workspaces before removed completely.
USER_WORKSPACES_ALLOWEDBooleantrueAllow users to create their own workspaces else it is available for superuser only

Data synchronisation and management

Other settings related to data management.

Variable nameTypeDefaultDescription
LOCAL_PROJECTSstring./projectsDirectory to store projects on a container. Please refer to volume mapping in docker-compose file.
TEMP_DIRstringResult of gettempdir() callTrash directory for temp files being cleaned regularly. Please refer to volume mapping in docker-compose file.
MAINTENANCE_FILEstring/data/MAINTENANCEFile to indicate server is in maintenance - read only mode. Please refer to volume mapping in docker-compose file.
BLACKLISTstring.mergin/, .DS_Store, .directoryPattern to ignore when syncing files.
FILE_EXPIRATIONinteger172800When the GeoPackage file was updated with "diffable" change, original data are being removed (as they can be reconstructed on demand) to save disk space. File lifetime in seconds.
LOCKFILE_EXPIRATIONinteger300Time in seconds for a project being locked while updated. If no change happens to the project in such time, the lockfile is removed.
MAX_CHUNK_SIZEinteger10485760Maximum size of file chunk to be uploaded (and received by server) in bytes.
MAX_DOWNLOAD_ARCHIVE_SIZEinteger1073741824Maximum size of project zip archive in bytes for direct download. Too large projects may take too long to download or never complete in one request.
USE_X_ACCEL ⭐️BooleantrueWhether to use nginx to serve files. Should be enabled if used with nginx proxy for performance reasons. Read more here.
CLOSED_ACCOUNT_EXPIRATIONinteger1Time in days after a user closed their account to all projects and files are permanently deleted. Please note that until the user is removed, the username/email is occupied.
DELETED_PROJECT_EXPIRATIONinteger7Lifetime in days for deleted projects. Expired projects are removed permanently without possibility to restore afterwards.
PROJECT_ACCESS_REQUESTinteger604800Lifetime of active project access request in seconds.
TEMP_EXPIRATIONinteger7Time in days after files in a temporary folder are permanently deleted.

Celery asynchronous tasks

Mergin Maps is using Celery and Redis to perform asynchronous tasks or doing regular jobs.

Variable nameTypeDefaultDescription
BROKER_URL ⭐️stringredis://merginmaps-redis:6379/0Connection details to celery message broker. If non-default, it should match definition in docker-compose file.
CELERY_RESULT_BACKENDstringredis://merginmaps-redis:6379/0Connection details to celery result back-end broker. If non-default, it should match definition in docker-compose file.
CELERYD_CONCURRENCYintegerAll CPUNumber of child processes. As rule of thumb do not use all available CPUs.
CELERYD_PREFETCH_MULTIPLIERinteger4The number of messages to prefetch at a time multiplied by the number of concurrent processes. Default is 4. If you want to disable this feature set it to 1.
CELERY_ACKS_LATEbooleanFalseIf True, means tasks will be transmitted as execute, AFTER they are finished, not 'right before'.