Applications

Environment variables

What Nautvia injects for you, how to add your own, and the one variable most Magento stores need.

Environment variables live under Settings → Environment variables. They are stored encrypted and they take effect on the next deploy.

What Nautvia injects

When you attach a database, a cache and a search cluster, their connection details are worked out for you. You never type a host or a password:

Variable Value
DB_HOST The database server's private network address
DB_PORT 3306
DB_DATABASE The attached logical database
DB_USERNAME The generated user for that database
DB_PASSWORD The generated password
REDIS_HOST The cache server's private address
REDIS_PORT 6379
OPENSEARCH_HOST The search server's private address
OPENSEARCH_PORT 9200

These are private addresses. The database, cache and search servers are not reachable from the internet — see Databases, cache and search.

Adding your own

One per line, KEY=value. Blank lines and lines starting with # are ignored, and surrounding quotes are stripped:

# Adobe Marketplace credentials, needed by composer install
MAGENTO_COMPOSER_AUTH={"http-basic":{"repo.magento.com":{"username":"KEY","password":"SECRET"}}}

PAYMENT_GATEWAY_KEY=pk_live_...

Your variables override the injected ones. If you set DB_HOST yourself, yours wins — which is how you point a store at a database Nautvia does not manage, and also how you break it by accident.

MAGENTO_COMPOSER_AUTH

This is the one nearly every store needs. If composer.json pulls anything from repo.magento.com, the build has no credentials and fails with a 401.

Set it to the JSON Composer expects, on a single line:

MAGENTO_COMPOSER_AUTH={"http-basic":{"repo.magento.com":{"username":"YOUR_PUBLIC_KEY","password":"YOUR_PRIVATE_KEY"}}}

Nautvia passes it to Composer as COMPOSER_AUTH for the duration of the build. It is written to a file that is readable only by the deploy user and removed afterwards; it never appears in the deploy log.

An important limitation

These are not real process environment variables. They are used to build your app/etc/env.php and to supply secrets to the deploy script. getenv('PAYMENT_GATEWAY_KEY') inside your Magento code will not find them.

For your own configuration, read it from env.php through Magento's DeploymentConfig, or set it with bin/magento config:set — see commands.

What env.php ends up containing

Nautvia generates it on every deploy: MAGE_MODE=production, your database credentials, Redis for sessions (database 2, locking disabled), Redis for the default cache (database 0) and the full page cache (database 1), OpenSearch as the search engine with the magento2 index prefix, all cache types enabled, and SAMEORIGIN frame options.

Your crypt key is generated once, on the first install, and reused on every deploy after that — which is what keeps previously encrypted values readable.