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 hashes)

Uploaded Source

Built Distribution

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

Uploaded Python 3

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