Skip to main content

An add-on for Plone

Project description

Latest Version Supported - Python Versions Number of PyPI downloads License Tests Coverage

collective.regenv

This product allows to override the values stored in the portal registry and property manager object (i.e. a PAS plugin) with values defined on a local file defined in an environment variable called PLONE_REGISTRY_YAML.

When it comes to PropertyManager, this product actually only works if you use the accessor getProperty to read properties.

Features

Using this product you can:

  1. have different values for development and production environments (think about the MailHost settings, connection parameters to external services, etc.)

  2. have different values for different instances in the same buildout, allowing for example to toggle features on and off for A/B testing.

Documentation

Registry overrides should be in a YAML file:

% cat sample.yaml

defaults: &defaults
    plone.cachepurging.interfaces.ICachePurgingSettings.cachingProxies:
        - http://localhost:8000
        - http://localhost:8001
    plone.app.theming.interfaces.IThemeSettings.hostnameBlacklist:
        - 127.0.0.1
        - localhost

/Plone/portal_registry:
    <<: *defaults

/Plone2/portal_registry:
    <<: *defaults
    plone.cachepurging.interfaces.ICachePurgingSettings.cachingProxies:
        - http://localhost:9000

/Plone/acl_users/oidc:
    issuer:
        http://localhost:1234/realms/plone/
    client_id:
        plone

Run zope instance with environment pointing to the YAML file, for example:

PLONE_REGISTRY_YAML=$(pwd)/sample.yaml bin/instance fg

Or using the docker image, for example:

docker run -p 8080:8080 \
    -e ADDONS=collective.regenv \
    -e PLONE_REGISTRY_YAML=/app/registry.yaml \
    -v$(pwd)/sample.yaml:/app/registry.yaml \
    plone/plone-backend:latest

Alternatively you can add the contents of the YAML file in an environment variable called PLONE_REGISTRY_YAML_CONTENT and pass the values directly. This way you do not need to mount a volume with the configuration file. For example:

export PLONE_REGISTRY_YAML_CONTENT=$(cat sample.yaml)
docker run -p 8080:8080 \
    -e ADDONS=collective.regenv \
    -e PLONE_REGISTRY_YAML_CONTENT
    plone/plone-backend:latest

Installation

Install collective.regenv by adding it to your buildout:

[buildout]

...

eggs =
    collective.regenv

and then running bin/buildout

Contribute

License

The project is licensed under the GPLv2.

Contributors

Changelog

1.0.0 (2023-11-15)

  • Add another environment variable to get the YAML file content from [erral]

1.0.0rc1 (2023-03-21)

  • Get overridden keys more efficiently. [maurits]

  • Fix python_requires metadata. [maurits]

1.0.0a2 (2022-12-27)

  • Fix monkeys init [mamico]

1.0.0a1 (2022-12-27)

  • Initial release. [mamico]

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

collective.regenv-1.0.0.tar.gz (19.0 kB view details)

Uploaded Source

Built Distribution

collective.regenv-1.0.0-py3-none-any.whl (16.1 kB view details)

Uploaded Python 3

File details

Details for the file collective.regenv-1.0.0.tar.gz.

File metadata

  • Download URL: collective.regenv-1.0.0.tar.gz
  • Upload date:
  • Size: 19.0 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/4.0.2 CPython/3.11.4

File hashes

Hashes for collective.regenv-1.0.0.tar.gz
Algorithm Hash digest
SHA256 bf377c9ea873ff3d3d722dd60b9b003040267f91390006a06e2b06eb2a241981
MD5 0408aacb884a5d90aaa94297283b6171
BLAKE2b-256 fbeab94ba30e2d12b489f7371c9c4f24d5e3a148940d794162092766a5f093a8

See more details on using hashes here.

File details

Details for the file collective.regenv-1.0.0-py3-none-any.whl.

File metadata

File hashes

Hashes for collective.regenv-1.0.0-py3-none-any.whl
Algorithm Hash digest
SHA256 74236bb8522b5693269993f97ef49c01521cf2e641db44cb9aff4d28d09f3204
MD5 8173261ca1d4f725b2b55a12d99ad93f
BLAKE2b-256 a8d9368baf98bcb88928ff88dde91dcf818f7b62f2ca7cd3ed585c2409b788c1

See more details on using hashes here.

Supported by

AWS AWS Cloud computing and Security Sponsor Datadog Datadog Monitoring Fastly Fastly CDN Google Google Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Sentry Sentry Error logging StatusPage StatusPage Status page