Skip to main content

plone.registryfromenviron

Override plone.registry values from environment variables.

Plone stores configuration in a persistent registry inside ZODB. This works well for through-the-web editing, but conflicts with modern deployment practices where configuration is injected via environment variables.

This package bridges that gap, making Plone cloud-native and 12-factor app friendly: the same Plone image can run in development, staging and production with different settings -- controlled entirely by environment variables, no ZODB changes needed.

How it works

At import time, the package scans os.environ for PLONE_REGISTRY_* variables. If any are present, it patches plone.registry.registry.Registry.__getitem__ and .get so that reads consult the env-var values first, falling back to ZODB when a key is not overridden. If lineage.registry is installed, its LineageRegistry (the subsite registry of collective.lineage) is patched the same way, so overrides apply in lineage subsites too. If no matching env vars are set, the package is a silent no-op with zero runtime cost.

All existing registry data is preserved — overrides are read-only and never written to ZODB.

Installation

Add the package to your Plone image / buildout / Python environment. That's it — no GenericSetup profile needs to be applied and nothing is written to ZODB.

The package ships with a plone.registryfromenviron:default profile for backwards compatibility with 1.x, but it is an empty no-op. You may leave it listed as a dependency in your own metadata.xml without any effect.

"Uninstalling" means removing the package from the deployment (and restarting the processes). There is no uninstall profile in 2.0.

Environment variable format

PLONE_REGISTRY_<registry_key>=<value>

Registry keys use dots (e.g. plone.smtp_host). Since dots are not allowed in environment variable names, replace each . with __ (double underscore). Single underscores are preserved as-is.

Examples

# plone.smtp_host = "mail.example.com"
export PLONE_REGISTRY_plone__smtp_host=mail.example.com

# plone.app.theming.interfaces.IThemeSettings.enabled = False
export PLONE_REGISTRY_plone__app__theming__interfaces__IThemeSettings__enabled=false

# plone.cachepurging.interfaces.ICachePurgingSettings.cachingProxies = ["http://varnish:8080"]
export PLONE_REGISTRY_plone__cachepurging__interfaces__ICachePurgingSettings__cachingProxies='["http://varnish:8080"]'

Type coercion

Values are automatically coerced based on the existing registry record's field type:

Field type Env value example Result
Bool true, 1, yes, on True
Bool false, 0, no, off False
Int 42 42
Float 3.14 3.14
TextLine / Text hello "hello"
List ["a", "b"] ["a", "b"]
Tuple ["a", "b"] ("a", "b")
Set ["a", "b"] {"a", "b"}
Dict {"key": "val"} {"key": "val"}

Collection and dict values use JSON syntax.

Behavior

  • Environment variables are scanned once at process startup. Changes require a restart.
  • Activation is automatic: if PLONE_REGISTRY_* variables are present, the patch is applied at first import. If not, nothing happens.
  • Overrides are read-only — writes via the registry API still go to ZODB, but subsequent reads for overridden keys return the env value.
  • Only existing registry keys can be overridden (the field definition is needed for type coercion).
  • Invalid values or unknown keys are logged and silently skipped (ZODB value is used as fallback).
  • Overrides apply to the Plone site root and to lineage subsites alike. An override wins over a value stored locally in a subsite. There is no way to set different env values per subsite.
  • Known limitations:
    • Direct access via registry.records['key'].value bypasses the override, the same as in 1.x. Use registry['key'], registry.get('key'), or a RecordsProxy (all go through the patched read path).
    • Other Registry subclasses that override __getitem__ or get themselves are not patched. Only plone.registry's Registry (and subclasses inheriting its methods, such as plone.app.registry's) and lineage.registry's LineageRegistry are covered.

Upgrading from 1.x

Version 2.0 drops the portal_registry.__class__ swap approach (see issue #1 for the root-cause analysis).

For operators upgrading from 1.x:

  • Deploy 2.0, then click "Upgrade" once in the Plone Add-ons control panel. A GenericSetup upgrade step (1 → 2) clears any stale EnvOverrideRegistry class references from the site root and unregisters the addon from the "Installed" list of the control panel. Runtime activation is driven by env vars; the click only tidies up ZODB and the UI. If you do nothing, the addon keeps working correctly — the cleanup is cosmetic.
  • No uninstall step needed. Stop setting PLONE_REGISTRY_* env vars to deactivate, or remove the package from the deployment.
  • The plone.registryfromenviron:uninstall profile is gone. If your automation calls it, remove the call — it's a no-op.
  • Activation is now import-driven, not install-step-driven. Every pod picks up the behavior immediately on startup; no per-site install run is required anymore.

Source Code and Contributions

The source code is managed in a Git repository, with its main branches hosted on GitHub. Issues can be reported there too.

We'd be happy to see many forks and pull requests to make this package even better. We welcome AI-assisted contributions, but expect every contributor to fully understand and be able to explain the code they submit. Please don't send bulk auto-generated pull requests.

Maintainers are Jens Klein, Johannes Raggam and the BlueDynamics Alliance developer team. We appreciate any contribution and if a release on PyPI is needed, please just contact one of us. We also offer commercial support if any training, coaching, integration or adaptations are needed.

License

GPL-2.0-only

Metadata

Release files for plone.registryfromenviron 2.0.1

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for plone.registryfromenviron 2.0.1
File Size Uploaded Provenance Actions
plone_registryfromenviron-2.0.1.tar.gz 21.8 kB With provenance Details for plone_registryfromenviron-2.0.1.tar.gz

Built distribution (wheel)

Table of built distributions (wheels) for plone.registryfromenviron 2.0.1
File Interpreter ABI Platform Actions
plone_registryfromenviron-2.0.1-py3-none-any.whl Python 3 none any Details for plone_registryfromenviron-2.0.1-py3-none-any.whl

Total release size: 31.5 kB

Release files / plone_registryfromenviron-2.0.1.tar.gz

Download URL plone_registryfromenviron-2.0.1.tar.gz
Size 21.8 kB
Tags Source
SHA-256 checksum
How to use checksums
24670b82ee60b35bc8566b41b3f8e7d27c7e0e458973406b5d9a52ffeef07b68
BLAKE2b-256 checksum
How to use checksums
2e99d4a6a6174e691b0265b91c0914c3d7a9ca1aa5d057dfce0688c22ac69da6
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/7.0.0 CPython/3.13.16

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Oct 30, 2026.

Transparency log

Release files / plone_registryfromenviron-2.0.1-py3-none-any.whl

Download URL plone_registryfromenviron-2.0.1-py3-none-any.whl
Size 9.7 kB
Tags Python 3
SHA-256 checksum
How to use checksums
5b8af17abce7b1ed97cf5e54bf86a803e2200ede1ce01efa748324ce84c34f16
BLAKE2b-256 checksum
How to use checksums
3ed75ef4d8535e0c7ecf82842dabd83e22e20ec254b62bcd1a6660711bfdf23c
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/7.0.0 CPython/3.13.16

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Oct 30, 2026.

Transparency log

Security for plone.registryfromenviron 2.0.1

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

Full provenance

Both files in this release have been uploaded with provenance metadata.

Select from 2 files

Attestation for plone_registryfromenviron-2.0.1.tar.gz

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Oct 30, 2026.

Transparency log

A note on package security

PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.

To learn more about protecting yourself from malicious actors, visit our package security documentation.

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page