|
| 1 | +--- |
| 2 | +description: Environment variables automatically generated by Ibexa Cloud based on Platform.sh relationships and routes. |
| 3 | +--- |
| 4 | + |
| 5 | +# Environment variables on Ibexa Cloud |
| 6 | + |
| 7 | +[[= product_name_cloud =]] automatically generates environment variables based on the Platform.sh relationships and routes configuration. |
| 8 | +It parses `PLATFORM_RELATIONSHIPS` and `PLATFORM_ROUTES` environment variables and exposes them as application-specific variables. |
| 9 | + |
| 10 | +Environment variable prefixes are created by converting relationship names to uppercase and replacing hyphens with underscores. |
| 11 | +When multiple endpoints are defined for a single relationship, numerical indices are used, for example: `SOLR_1_`, `SOLR_2`. |
| 12 | + |
| 13 | +## Relationship naming conventions |
| 14 | + |
| 15 | +Use the following relationship names in `.platform.app.yaml`: |
| 16 | + |
| 17 | +- `database` - main application database |
| 18 | +- `dfs_database` - DFS database (required name for DFS functionality) |
| 19 | +- `rediscache` - Redis for cache |
| 20 | +- `redissession` - Redis for sessions (recommended name for dedicated session storage) |
| 21 | +- `elasticsearch` - Elasticsearch search service |
| 22 | +- `solr` - Solr search service |
| 23 | + |
| 24 | +## Database variables |
| 25 | + |
| 26 | +For MySQL and PostgreSQL databases, the following variables are generated based on the relationship name (e.g., `database`): |
| 27 | + |
| 28 | +- `{RELATIONSHIP_NAME}_URL` - full database URL with charset and server version |
| 29 | +- `{RELATIONSHIP_NAME}_USER` / `{RELATIONSHIP_NAME}_USERNAME` - database user |
| 30 | +- `{RELATIONSHIP_NAME}_PASSWORD` - database password |
| 31 | +- `{RELATIONSHIP_NAME}_HOST` - database host |
| 32 | +- `{RELATIONSHIP_NAME}_PORT` - database port |
| 33 | +- `{RELATIONSHIP_NAME}_NAME` / `{RELATIONSHIP_NAME}_DATABASE` - database name |
| 34 | +- `{RELATIONSHIP_NAME}_DRIVER` - database driver |
| 35 | +- `{RELATIONSHIP_NAME}_SERVER` - database server |
| 36 | + |
| 37 | +For example, for a relationship called `database` the environment variables are named `DATABASE_URL`, `DATABASE_HOST`, `DATABASE_USER`, etc. |
| 38 | + |
| 39 | +For more information about database configuration, see [Databases](databases.md). |
| 40 | + |
| 41 | +## DFS database variables |
| 42 | + |
| 43 | +When using [distributed file storage (DFS) using a separate database](clustering.md#dfs-io-handler), you must use the relationship name `dfs_database`. |
| 44 | +In addition to the database variables listed above, additional DFS-specific variables are created when `PLATFORMSH_DFS_NFS_PATH` is set: |
| 45 | + |
| 46 | +- `DFS_NFS_PATH` - NFS path for DFS storage |
| 47 | +- `DFS_DATABASE_CHARSET` - database character set |
| 48 | +- `DFS_DATABASE_COLLATION` - database collation |
| 49 | + |
| 50 | +## Cache variables |
| 51 | + |
| 52 | +For Redis and Memcached cache services, the following variables are available. |
| 53 | + |
| 54 | +- `{RELATIONSHIP_NAME}_URL` (Redis only) |
| 55 | +- `{RELATIONSHIP_NAME}_HOST` |
| 56 | +- `{RELATIONSHIP_NAME}_PORT` |
| 57 | +- `{RELATIONSHIP_NAME}_SCHEME` (Redis only) |
| 58 | + |
| 59 | +In addition, the following global variables are defined: |
| 60 | + |
| 61 | +- `CACHE_POOL` - either `cache.redis` or `cache.memcached` |
| 62 | +- `CACHE_DSN` - cache connection string |
| 63 | + |
| 64 | +!!! note |
| 65 | + Redis services have higher priority than Memcached services when building the global cache variables. |
| 66 | + |
| 67 | +For more information about persistence cache configuration, see [Persistence cache](persistence_cache.md). |
| 68 | + |
| 69 | +## Session variables |
| 70 | + |
| 71 | +For Redis-based session storage, the following variables are available. |
| 72 | + |
| 73 | +- `SESSION_HANDLER_ID` - session handler class name |
| 74 | +- `SESSION_SAVE_PATH` - Redis connection in `host:port` format |
| 75 | + |
| 76 | +The system looks for a relationship named `redissession` first. If not found, it uses the first available Redis service. |
| 77 | + |
| 78 | +For more information about session configuration, see [Sessions](sessions.md). |
| 79 | + |
| 80 | +## Search engine variables |
| 81 | + |
| 82 | +### Solr |
| 83 | + |
| 84 | +For Solr search engine configuration, the following variables are generated: |
| 85 | + |
| 86 | +- `SEARCH_ENGINE` - set to `solr` |
| 87 | +- `SOLR_DSN` - Solr connection string |
| 88 | +- `SOLR_CORE` - Solr core name |
| 89 | +- `{RELATIONSHIP_NAME}_HOST` |
| 90 | +- `{RELATIONSHIP_NAME}_PORT` |
| 91 | +- `{RELATIONSHIP_NAME}_NAME` / `{RELATIONSHIP_NAME}_DATABASE` |
| 92 | + |
| 93 | +For more information, see [Solr search engine](solr_overview.md). |
| 94 | + |
| 95 | +### Elasticsearch |
| 96 | + |
| 97 | +For Elasticsearch search engine configuration, the following variables are generated: |
| 98 | + |
| 99 | +- `SEARCH_ENGINE` - set to `elasticsearch` |
| 100 | +- `ELASTICSEARCH_DSN` - Elasticsearch connection string |
| 101 | +- `{RELATIONSHIP_NAME}_URL` |
| 102 | +- `{RELATIONSHIP_NAME}_HOST` |
| 103 | +- `{RELATIONSHIP_NAME}_PORT` |
| 104 | +- `{RELATIONSHIP_NAME}_SCHEME` |
| 105 | + |
| 106 | +For more information, see [Elasticsearch](elasticsearch_overview.md). |
| 107 | + |
| 108 | +## HTTP cache variables (Varnish) |
| 109 | + |
| 110 | +For Varnish-based HTTP caching, the following variables are available. |
| 111 | + |
| 112 | +- `HTTPCACHE_PURGE_TYPE` - set to `varnish` |
| 113 | +- `HTTPCACHE_PURGE_SERVER` - Varnish server address |
| 114 | +- `HTTPCACHE_VARNISH_INVALIDATE_TOKEN` - token for cache invalidation |
| 115 | + |
| 116 | +For more information about HTTP cache and Varnish configuration, see [HTTP cache](http_cache.md). |
0 commit comments