Skip to main content

Configs

In any software project, configuration values are crucial. Gallifrey Rules enhances this experience by offering unparalleled flexibility in managing these values across various levels of granularity.

To ensure consistency and future-proofing, it's advisable to always use the following methods when accessing configuration values within your plugins. Even for configurations that may not require immediate control or modification at runtime, it is best practice to use these methods with default values. This approach allows for seamless overrides at runtime as your requirements evolve.

The default ConfigurationProvider in Gallifrey Rules is designed to extract values from environment variables. For instance, consider a scenario where your plugin code retrieves the SMTP server details. This value can be easily provided using the CONFIG_DEFAULT_SMTP_SERVER environment variable. Learn more.

Gallifrey Rules further empowers users by enabling configuration values to be specified at namespace/entity/event levels. This feature provides a mechanism to override specific configurations for particular events by utilizing the $config attribute on different levels.

If you look closely at the schema, you will see the different levels where you can provide $config values.

You can provide it at:

  1. Namespace Level Config
  2. Entity Level Config
  3. Event Level Config

This capability is exceptionally powerful, allowing you to define overrides at varying levels of detail and control specific configurations at a more granular level.

The values defined within the schema are consolidated into a single configuration object and supplied to the ConfigurationProvider, integrating them into its overarching configuration retrieval mechanism.