Siteaccesses and configuration
This page is for engineers who need to reason about configuration: where a value comes from, why it differs between two sites of one installation, and how to keep secrets and machine-specific values out of version control. The full reference is The INI settings cascade and INI override directories and placements.
Contents
- INI files and eZINI
- The order of the cascade
- Siteaccesses
- Environments, deployments and secrets
- Finding where a value comes from
- Rules for configuration changes
INI files and eZINI
All configuration is INI files read through eZINI (lib/ezutils/classes/ezini.php). The defaults ship in
settings/<file>.ini; overrides are named <file>.ini.append.php (the .php suffix keeps them from being served as
text). Code reads a value with:
$value = eZINI::instance( 'site.ini' )->variable( 'SiteSettings', 'SiteName' );No code in kernel/, lib/ or bin/ parses INI files itself. The merged result is cached as PHP arrays in the INI
cache; after a settings change clear it with the tag, which covers both the per-siteaccess and the global INI cache:
php bin/php/ezcache.php --clear-tag=ini --allow-root-userThe order of the cascade
Later wins:
| Order | Scope | Directories |
|---|---|---|
| 0 | defaults | settings/<file>.ini |
| 1 | sa-extension | extension/<ext>/settings/ of the extensions in the siteaccess's ActiveAccessExtensions[] |
| 2 | siteaccess | per-siteaccess directories inside extensions (extension/<ext>/settings/siteaccess/<sa>/, settings/override__<group>/, settings/override/), then settings/siteaccess/<sa>/ |
| 3 | extension | extension/<ext>/settings/ of the extensions in ActiveExtensions[] (the first listed wins) |
| 4 | override | settings/override/ |
Two consequences engineers trip over:
- The
settings/of an extension inActiveExtensions[]wins oversettings/siteaccess/<sa>/; that of an extension inActiveAccessExtensions[]does not. settings/override/wins over everything.
Extensions are switched on in site.ini [ExtensionSettings] ActiveExtensions[] (global) and
ActiveAccessExtensions[] (per siteaccess); these two cannot be set from inside an extension. The order of
extensions can follow their declared dependencies (Extension loading order).
Siteaccesses
A siteaccess is a named configuration selected per request: a public site, the administration, a language version.
eZSiteAccess (kernel/classes/ezsiteaccess.php) matches it from site.ini [SiteAccessSettings]:
| Setting | Purpose |
|---|---|
MatchOrder | the match types tried, shipped uri;host;port |
AvailableSiteAccessList[] | only these siteaccesses are matched |
RelatedSiteAccessList[] | related siteaccesses sharing the same database |
HostMatchMapItems[] | host name to siteaccess |
AnonymousAccessList[] | modules or module views that do not require a sign-in on a siteaccess that otherwise does (user/register, csp/report ...) |
Code takes the current siteaccess from eZSiteAccess::current() and never parses the URL itself. Host and language
matching: Siteaccess host and language matching.
Environments, deployments and secrets
| Need | Mechanism |
|---|---|
| Different values on a developer machine, a test copy and the live site | EXP_ENV in config.env.php (from config.env.php.example), and variant files such as settings/override/site.ini.test.append.php (Settings per environment) |
| Configuration that only version control may change | [ConfigurationSettings] ManagedByDeployment=enabled per siteaccess: the administration no longer writes settings, templates or packages on the server (Configuration managed by the deployment) |
| Secrets (database passwords, API keys, signing keys) | settings/override/, which is never committed; config.env.php is in .gitignore |
| Several sites in one installation | per-site settings inside extensions (Multi-site installations) |
Finding where a value comes from
./console exp:ini where site.ini/SiteSettings/SiteName
./console exp:ini get site.ini/SiteSettings/SiteNamewhere lists every file that sets the value, in load order, and the value in effect; exp:ini also sets, adds and
removes values in a chosen scope (exp:ini). On a running installation the
administration shows the merged settings under Setup (The settings page).
Rules for configuration changes
- A new setting gets its default in the shipped
settings/<file>.iniwith a comment above it, a safe default, a section on its feature page and a line in the changelog. - New switches use
enabled/disabled. - Settings are written with
./console exp:inioreZINI::save(), never by string replacement in a script. - A new class referenced from a shipped INI file should be guarded with
class_exists()in the kernel, because a Velocity worker started before the deploy does not know it (Deploying a change).
Related pages
- Settings and INI files
- Settings scopes and their order
- Multi-site installations
- Free documentation: this page is free to copy, translate and improve under the GNU FDL 1.3.
Become an Exponential Partner
Partners share their information, provide funding, contribute back and develop the products with us, and that is how Exponential grows. A partner website and dashboard are planned for mid-2027: please become a partner today to speed up our growth rate and land new features faster.