---
url: /on-premises/config/env/api.md
---
# BIMData API

## URLs of BIMData apps

| Variables   | Default value | Description                |
|-------------|---------------|----------------------------|
| API\_URL     | ""            | BIMData API URL.           |
| CONNECT\_URL | ""            | BIMData Connect URL.       |
| DOC\_URL     | ""            | BIMData Documentation URL. |

## Database configuration

There variables are needed for the database authentication.

| Variables            | Default value    | Description                |
|----------------------|------------------|----------------------------|
| DB\_HOST              |                  | Postgresql server address. |
| DB\_PORT              |                  | Postgresql server port.    |
| DB\_NAME              |                  | Postgresql database name.  |
| DB\_USER              |                  | Postgresql user.           |
| DB\_PASSWORD          |                  | Postgresql password.       |

If your Postgresql cluster use read-only replicas, you can configure the API
with these variables to distribute the read-only requests through all of them.
Each of these variable is a comma separated list. If each replica have a different
configuration, the order in each list matter: the first element `REPLICA_DB_HOSTS`
will use the first port in `REPLICA_DB_PORTS` and so on.

| Variables            | Default value       | Description                                           |
|----------------------|---------------------|-------------------------------------------------------|
| REPLICA\_DB\_HOSTS     | ""                  | list of postgresql read-only replicas server address. |
| REPLICA\_DB\_PORTS     | Same as DB\_PORT     | list of postgresql read-only replicas server port.    |
| REPLICA\_DB\_NAMES     | Same as DB\_NAME     | list of postgresql read-only database name.           |
| REPLICA\_DB\_USERS     | Same as DB\_USER     | list of postgresql read-only database user.           |
| REPLICA\_DB\_PASSWORDS | Same as DB\_PASSWORD | list of postgresql read-only database user.           |

## RabbitMQ configuration

| Variables         | Default value | Description              |
|-------------------|---------------|--------------------------|
| RABBITMQ\_HOST     |               | RabbitMQ server address. |
| RABBITMQ\_PORT     |               | RabbitMQ server port.    |
| RABBITMQ\_USER     |               | RabbitMQ username.       |
| RABBITMQ\_PASSWORD |               | RabbitMQ password.       |

## OpenID configuration

::: v-pre
| Variables                    | Default value           | Description            |
|------------------------------|-------------------------|------------------------|
| IAM\_URL                      |                         | OIDC provider address. |
| IAM\_ADMIN\_LOGIN              |                         | OIDC admin username.   |
| IAM\_ADMIN\_PASSWORD           |                         | OIDC admin password.   |
:::

## Storage configuration

By default, the API use a local storage in `/opt/storage` to store all the uploaded datas.
But these datas are not serve by the API itself. It's necessary to configure a web
server, like other static files.
That's why we recommande using an object storage for production.

To enable Swift usage, you need to set `SWIFT_AUTH_URL`, and if this variable is
set, alors the other variables `SWIFT_*` need to be set.

| Variables                                | Default value                                                                                | Description                                                                                                        |
|------------------------------------------|----------------------------------------------------------------------------------------------|--------------------------------------------------------------------------------------------------------------------|
| SWIFT\_AUTH\_URL                           |                                                                                              | The URL for the auth server.                                                                                       |
| SWIFT\_USERNAME                           |                                                                                              | The username to use to authenticate.                                                                               |
| SWIFT\_PASSWORD                           |                                                                                              | The key (password) to use to authenticate.                                                                         |
| SWIFT\_AUTH\_VERSION                       | 3                                                                                            | The version of the authentication protocol to use.                                                                 |
| SWIFT\_TENANT\_NAME / SWIFT\_PROJECT\_NAME   | None                                                                                         | The tenant/project name to use when authenticating.                                                                |
| SWIFT\_TENANT\_ID / SWIFT\_PROJECT\_ID       | None                                                                                         | The tenant/project id to use when authenticating.                                                                  |
| SWIFT\_USER\_DOMAIN\_NAME                   | None                                                                                         | The domain name we authenticate to.                                                                                |
| SWIFT\_USER\_DOMAIN\_ID                     | "default"                                                                                    | The domain id we authenticate to.                                                                                  |
| SWIFT\_PROJECT\_DOMAIN\_NAME                | "default"                                                                                    | The domain name our project is located in.                                                                         |
| SWIFT\_PROJECT\_DOMAIN\_ID                  | None                                                                                         | The domain id our project is located in.                                                                           |
| SWIFT\_REGION\_NAME                        | None                                                                                         | OpenStack region if needed. Check with your provider.                                                              |
| SWIFT\_CONTAINER\_NAME                     | None                                                                                         | The container in which to store the files.                                                                         |
| SWIFT\_STATIC\_CONTAINER\_NAME              | None                                                                                         | Alternate container for storing staticfiles.                                                                       |
| SWIFT\_AUTO\_CREATE\_CONTAINER              | True                                                                                         | Should the container be created if it does not exist?                                                              |
| SWIFT\_AUTO\_CREATE\_CONTAINER\_PUBLIC       | False                                                                                        | Set the auto created container as public on creation                                                               |
| SWIFT\_AUTO\_CREATE\_CONTAINER\_ALLOW\_ORIGIN | "\*"                                                                                          | Set the container's X-Container-Meta-Access-Control-Allow-Origin value, to support CORS requests.                  |
| SWIFT\_AUTO\_BASE\_URL                      | True                                                                                         | Query the authentication server for the base URL.                                                                  |
| SWIFT\_BASE\_URL                           | None                                                                                         | The base URL from which the files can be retrieved.                                                                |
| SWIFT\_NAME\_PREFIX                        | ""                                                                                           | Prefix that gets added to all filenames.                                                                           |
| SWIFT\_USE\_TEMP\_URLS                      | True                                                                                         | Generate temporary URLs for file access (allows files to be accessed without a permissive ACL).                    |
| SWIFT\_TEMP\_URL\_KEY                       | None                                                                                         | Temporary URL key.                                                                                                 |
| SWIFT\_TEMP\_URL\_DURATION                  | 2 \* 60 \* 60                                                                                  | How long a temporary URL remains valid, in seconds.                                                                |
| SWIFT\_EXTRA\_OPTIONS                      | {}                                                                                           | Extra options.                                                                                                     |
| SWIFT\_STATIC\_AUTO\_BASE\_URL               | True                                                                                         | Query the authentication server for the static base URL.                                                           |
| SWIFT\_STATIC\_BASE\_URL                    | None                                                                                         | The base URL from which the static files can be retrieved,                                                         |
| SWIFT\_STATIC\_NAME\_PREFIX                 | None                                                                                         | Prefix that gets added to all static filenames.                                                                    |
| SWIFT\_CONTENT\_TYPE\_FROM\_FD               | False                                                                                        | Determine the files mimetypes from the actual content rather than from their filename (default).                   |
| SWIFT\_FULL\_LISTING                       | True                                                                                         | Ensures to get whole directory contents (by default swiftclient limits it to 10000 entries)                        |
| SWIFT\_AUTH\_TOKEN\_DURATION                | 60 \* 60 \* 23                                                                                 | How long a token is expected to be valid in seconds.                                                               |
| SWIFT\_LAZY\_CONNECT                       | True                                                                                         | If True swift connection will be obtained on first use, if False it will be obtained during storage instantiation. |
| SWIFT\_GZIP\_CONTENT\_TYPES                 | \[None,"text/plain","application/json","application/octet-stream","image/svg+xml","text/xml"] | List of content type that will be compressed.                                                                      |
| SWIFT\_GZIP\_COMPRESSION\_LEVEL             | 4                                                                                            | Gzip compression level from 0 to 9. 0 = no compression, 9 = max compression                                        |
| SWIFT\_GZIP\_UNKNOWN\_CONTENT\_TYPE          | True                                                                                         | If set to True and the content-type can't be guessed, gzip anyway                                                  |
| SWIFT\_CACHE\_HEADERS                      | False                                                                                        | Headers cache on/off switcher                                                                                      |

## Email configuration

| Variables            | Default value          | Description                   |
|----------------------|------------------------|-------------------------------|
| SMTP\_HOST            |                        | SMTP server address.          |
| SMTP\_PORT            |                        | SMTP server port.             |
| SMTP\_USE\_TLS         |                        | SMTP communication use TLS.   |
| SMTP\_USER            |                        | SMTP authentication user.     |
| SMTP\_PASS            |                        | SMTP authentication password. |
| DEFAULT\_FROM\_EMAIL   | "support@bimdata.io"   | SMTP default from email.      |
| MODELS\_SUPPORT\_EMAIL | \[]                     |                               |

### Image configuration

| Variables            | Default value | Description                                            |
|----------------------|---------------|--------------------------------------------------------|
| WORKERS              | 4             | Configure Gunicorn workers.                            |
| PORT                 | 8000          | Configure Gunicorn listen port.                        |
| CA\_CERT              | ""            | Path of a certificate to add to container trusted CAs. |
| COMPILE\_SCSS         | 0             | 0 or 1. Configure if django compilescss during init.   |
| COLLECT\_STATIC       | 1             | 0 or 1. Configure if django collectstatic during init. |
| APPLY\_MIGRATION      | 1             | 0 or 1. Configure if django migrate during init.       |
| PROCESS\_TASKS        | 0             | 0 or 1. Configure if django process\_tasks.             |

## Other configuration

| Variables                        | Default value                       | Description                                        |
|----------------------------------|-------------------------------------|----------------------------------------------------|
| SECRET\_KEY                       | "SET\_DEVELOPMENT\_DJANGO\_SECRET\_KEY" |                                                    |
| MASTER\_TOKEN                     | ""                                  |                                                    |
| DATA\_UPLOAD\_MAX\_MEMORY\_SIZE      | 1 \* 1024 \*\* 3                       |                                                    |
| DATA\_UPLOAD\_MAX\_NUMBER\_FIELDS    | 1000                                |                                                    |
| ADMIN\_URL                        | ""                                  | Use to be able to deploy separate admin interface. |
| ADMIN\_INTERFACE                  |                                     | Use to be able to deploy separate admin interface. |
| DJANGO\_SETTINGS\_MODULE           | "bimdata.settings.api"              | Use to be able to deploy separate admin interface. |
| ENV                              | "development"                       |                                                    |
| ALLOWED\_HOSTS                    | \[]                                  |                                                    |
| DEBUG                            | False                               | Enable debug mode.                                 |
