Restoring settings from file

Settings can be read from a .env.settings file via the settings:restore Artisan command.

Create a .env.settings file specifically for a tenant/site. E.g. for Helix Sleep it would be .env.settings.helix-sleep. This is a normal .env file as we know it.

Take the following example of a .env.settings.helix-sleep file

KLARNA__ENVIRONMENT=https://na-library.playground.klarnaservices.com/lib.js

SHOPIFY__ENABLED=true
SHOPIFY__CHECKOUT_URL=https://checkout.helix-sleep.hlx.dev
SHOPIFY__SPLIT_LINE_ITEMS_TO_ONE_QUANTITY_PER_LINE_ITEM=[KEEP]

Setting are grouped by the name of the setting followed by two underscores __ and then the name of the setting, all SCREAMING_SNAKE_CASE. The value will be what gets added to the database. As you can see from the last entry, it can also take a specially formatted value: [KEEP]. When using this value, the Artisan command will keep the current setting stored in the database (unless it's an encrypted value, in that case it will be reset to an empty string). This can be useful when you restore a database from a production backup, and you want to keep some values from production, but you don't necessarily care what they are.

Was this helpful?