nchan_redis_pass_inheritable

The `nchan_redis_pass_inheritable` directive makes the Redis connection settings inheritable from parent contexts in NGINX.

Syntaxnchan_redis_pass_inheritable on | off;
Defaultoff
Contexthttp, server, location
Arguments1

Description

The nchan_redis_pass_inheritable directive allows NGINX configurations that utilize the Nchan module to inherit Redis configuration settings from higher context levels, such as 'http' or 'server'. This provides a way to set up common Redis connection parameters centrally, avoiding repetitive configuration across multiple locations or server blocks. When specified, it simplifies the management of Redis settings, ensuring that all nested contexts can leverage the same connection parameters without needing to redefine them each time.

When using this directive, the developer specifies the connection details associated with Redis server instances, including parameters such as host, port, and database. As a consequence, it streamlines configurations for complex applications that might have multiple Nchan pub/sub channels, facilitating smooth and efficient message publishing and subscribing across various components of an application. The behavior of this directive ensures that inheritable settings take precedence over those defined locally, thus maintaining clarity and consistency in configuration management.

Overall, nchan_redis_pass_inheritable enhances the flexibility of Nchan implementations by enabling developers to focus on the core logic of their applications while relying on the powerful inheritable setting capabilities of NGINX.

Config Example

http {
    nchan_redis_pass_inheritable on;
    server {
        location /pub {
            nchan_pubsub_channel_id mychannel;
        }
        location /sub {
            nchan_subscriber_channel_id mychannel;
        }
    }
}

Ensure that Redis is properly configured and accessible from NGINX to avoid connection issues.

Be careful to not redefine conflicting Redis parameters in nested contexts, which can lead to confusion.

Remember that settings are inherited; accidental misconfiguration in parent contexts can cascade down to children.

← Back to all directives