Skip to content

Environment variables on Ibexa Cloud

Ibexa Cloud automatically generates environment variables based on the Platform.sh relationships and routes configuration. It parses PLATFORM_RELATIONSHIPS and PLATFORM_ROUTES environment variables and exposes them as application-specific variables.

Environment variable prefixes are created by converting relationship names to uppercase and replacing hyphens with underscores. When multiple endpoints are defined for a single relationship, numerical indices are used, for example: SOLR_1_, SOLR_2.

Relationship naming conventions

Use the following relationship names in .platform.app.yaml:

  • database - main application database
  • dfs_database - DFS database (required name for DFS functionality)
  • rediscache - Redis for cache
  • redissession - Redis for sessions (recommended name for dedicated session storage)
  • elasticsearch - Elasticsearch search service
  • solr - Solr search service

Database variables

For MySQL and PostgreSQL databases, the following variables are generated based on the relationship name (e.g., database):

  • {RELATIONSHIP_NAME}_URL - full database URL with charset and server version
  • {RELATIONSHIP_NAME}_USER / {RELATIONSHIP_NAME}_USERNAME - database user
  • {RELATIONSHIP_NAME}_PASSWORD - database password
  • {RELATIONSHIP_NAME}_HOST - database host
  • {RELATIONSHIP_NAME}_PORT - database port
  • {RELATIONSHIP_NAME}_NAME / {RELATIONSHIP_NAME}_DATABASE - database name
  • {RELATIONSHIP_NAME}_DRIVER - database driver
  • {RELATIONSHIP_NAME}_SERVER - database server

For example, for a relationship called database the environment variables are named DATABASE_URL, DATABASE_HOST, DATABASE_USER, etc.

For more information about database configuration, see Databases.

DFS database variables

When using distributed file storage (DFS) using a separate database, you must use the relationship name dfs_database. In addition to the database variables listed above, additional DFS-specific variables are created when PLATFORMSH_DFS_NFS_PATH is set:

  • DFS_NFS_PATH - NFS path for DFS storage
  • DFS_DATABASE_CHARSET - database character set
  • DFS_DATABASE_COLLATION - database collation

Cache variables

For Redis and Memcached cache services, the following variables are available.

  • {RELATIONSHIP_NAME}_URL (Redis only)
  • {RELATIONSHIP_NAME}_HOST
  • {RELATIONSHIP_NAME}_PORT
  • {RELATIONSHIP_NAME}_SCHEME (Redis only)

In addition, the following global variables are defined:

  • CACHE_POOL - either cache.redis or cache.memcached
  • CACHE_DSN - cache connection string

Note

Redis services have higher priority than Memcached services when building the global cache variables.

For more information about persistence cache configuration, see Persistence cache.

Session variables

For Redis-based session storage, the following variables are available.

  • SESSION_HANDLER_ID - session handler class name
  • SESSION_SAVE_PATH - Redis connection in host:port format

The system looks for a relationship named redissession first. If not found, it uses the first available Redis service.

For more information about session configuration, see Sessions.

Search engine variables

Solr

For Solr search engine configuration, the following variables are generated:

  • SEARCH_ENGINE - set to solr
  • SOLR_DSN - Solr connection string
  • SOLR_CORE - Solr core name
  • {RELATIONSHIP_NAME}_HOST
  • {RELATIONSHIP_NAME}_PORT
  • {RELATIONSHIP_NAME}_NAME / {RELATIONSHIP_NAME}_DATABASE

For more information, see Solr search engine.

Elasticsearch

For Elasticsearch search engine configuration, the following variables are generated:

  • SEARCH_ENGINE - set to elasticsearch
  • ELASTICSEARCH_DSN - Elasticsearch connection string
  • {RELATIONSHIP_NAME}_URL
  • {RELATIONSHIP_NAME}_HOST
  • {RELATIONSHIP_NAME}_PORT
  • {RELATIONSHIP_NAME}_SCHEME

For more information, see Elasticsearch.

HTTP cache variables (Varnish)

For Varnish-based HTTP caching, the following variables are available.

  • HTTPCACHE_PURGE_TYPE - set to varnish
  • HTTPCACHE_PURGE_SERVER - Varnish server address
  • HTTPCACHE_VARNISH_INVALIDATE_TOKEN - token for cache invalidation

For more information about HTTP cache and Varnish configuration, see HTTP cache.