Skip to content

Enable by condition #20

@fabfuel

Description

@fabfuel

Hi there,

how can I enable the module conditionally? I want to be able to control, if the module is enabled, because we don't run Datadog agent locally or during CI.

The API.md says, that datadog_enable can be used in if context, but I was not able to make it work, the datadog_enable directive is just ignored in any if (...) {} block, like for example:

map $host $with_datadog {
    default   $DATADOG_ENABLED;
}

server {
    add_header X-Debug $with_datadog;

    if ($with_datadog = "true") {
        datadog_enable;
    }

    ...

But it works well without the if block

server {
    datadog_enable;

    ...

It's not an issue with the env var, I use envsubst and the add_header works as expected, the response header is true

X-Debug: true

Thankful for any hint!

Best
Fabian

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions