Environments
The class Config\Anvil holds what is the same everywhere; .env holds
what differs per environment and every secret.
What goes where
Section titled “What goes where”In app/Config/Anvil.php |
In .env |
|---|---|
| panels, policies, permissions, templates, building blocks | keys: encryption.key, anvil.auditKey, anvil.auditPreviousKeys |
| file types, working days, links | secrets: anvil.sso.<provider>.clientSecret |
| defaults of limits | limits that differ per environment, e.g. anvil.fileMaxSize |
anvil.holidayRegion, anvil.ssoAutoRedirect per site |
Example
Section titled “Example”# .env of productionCI_ENVIRONMENT = productionapp.baseURL = 'https://backoffice.example.com/'
encryption.key = hex2bin:…anvil.auditKey = base64:…
anvil.sso.adfs.clientSecret = …anvil.ssoAutoRedirect = adfsanvil.holidayRegion = BYanvil.fileMaxSize = 26214400# .env of developmentCI_ENVIRONMENT = developmentanvil.endpointRateLimit = 0anvil.ssoAutoRedirect =- Never commit
.env; keep secrets out of the class. - Values from
.envoverride the class; check the effective values withAnvil\Config\Anvil::resolve()in a test or command. - In production
httpsis required for links and single sign-on; the debug toolbar must be off (CI_ENVIRONMENT = production).
Server setup, keys and scheduled commands: Deployment.