Skip to content

Defaulting to ENV vars during container build is problematic #66

Open
@Richtermeister

Description

@Richtermeister

First off, this bundle has come a long way and I really like it now, great job, and thank you!

One snag I ran into though:

Expected behavior

According to the documentation I can configure this bundle via ENV vars, specifically, setting BUGSNAG_API_KEY – the idea of ENV vars being that I can change their values during deploy time to produce different runtime behavior.

Observed behavior

However, by default ENV vars only end up as a default-values to the container build step, and are consequently frozen into the container as resolved value. A change to ENV vars will not affect a change to the runtime configuration, without rebuilding the container. See: https://github.com/bugsnag/bugsnag-symfony/blob/master/DependencyInjection/Configuration.php#L26

Steps to reproduce

  1. Warm the cache (build container) while providing BUGSNAG_API_KEY via ENV var.
  2. Start a webserver hosting the bundle with a different ENV setting.
  3. Trigger error report & observe it going to the build-time account. Alternatively, look into the cached container and find frozen resolved value.

Version

1.5.0

Additional information

By explicitly specifying the api_key via ENV var, the bundle remains configurable at runtime:

bugsnag:
    api_key: "%env(BUGSNAG_API_KEY)%"

My recommendation would be to avoid setting default values via ENV inside the Configuration class and instead require them to be specified inside the bugsnag.yml config file.

Metadata

Metadata

Assignees

No one assigned

    Labels

    needs discussionRequires internal analysis/discussion

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions