Skip to content

Support optional values for Environment Provider #7284

@strawgate

Description

@strawgate

With #2261 if a customer provides an env var that doesn't exist, the input does not get included in the rendered configuration. This is a fantastic feature.

What would be really great is if we offered an alternative syntax for the env provider which made the env var optional during rendering:

${env.foo?}
${env.?foo}
${?env.foo}
$?{env.foo}
${optional.env.foo}

If the optional env var is not available, it would be lovely if only that setting didn't render. For example in the fleet policy

hosts: 
  - ${env.mysql}
interval: ${optional.env.mysql_interval}

if mysql exists but mysql_interval does not, agent would render

hosts:
  - ${env.mysql}

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions