man-group / dapr-sidekick-dotnet

Dapr Sidekick for .NET - a lightweight lifetime management component for Dapr
Apache License 2.0
175 stars 21 forks source link

Issue 28 : Fix Namespace configuration issue, support for custom environment variables #29

Closed badgeratu closed 2 years ago

badgeratu commented 2 years ago

Description

This PR fixes Issue #28 where the NAMESPACE environment variable was only set when mTLS was enabled. It also introduces a new feature for setting custom environment variables through configuration, overriding any environment variables that would have been set based on other configuration values. The new EnvironmentVariables property is available at any of the process options levels in configuration, for example:

  "DaprSidekick": {
    "EnvironmentVariables": {
      "MYVAR": "DEFAULT_VALUE",
      "NAMESPACE": "CUSTOM_VALUE"
    },
    "Sidecar": {
      "EnvironmentVariables": {
        "MYVAR": "OVERRIDE_VALUE"
      },
      "Namespace": "default"
    }
  }

This configuration setting will write out the environment variables MYVAR=OVERRIDE_VALUE and NAMESPACE=CUSTOM_VALUE - so the Sidecar-specific MYVAR overrides the top-level default value, and the top-level NAMESPACE overrides the value that would have been set via the Namespace property.

Issue reference

This PR will close issue: #28

Checklist

Please make sure you've completed the relevant tasks for this PR, out of the following list:

codecov-commenter commented 2 years ago

:warning: Please install the 'codecov app svg image' to ensure uploads and comments are reliably processed by Codecov.

Codecov Report

All modified and coverable lines are covered by tests :white_check_mark:

Project coverage is 88.98%. Comparing base (eda4078) to head (00021ec). Report is 6 commits behind head on main.

:exclamation: Your organization needs to install the Codecov GitHub app to enable full functionality.

Additional details and impacted files ```diff @@ Coverage Diff @@ ## main #29 +/- ## ========================================== + Coverage 88.79% 88.98% +0.18% ========================================== Files 104 104 Lines 2241 2252 +11 Branches 455 460 +5 ========================================== + Hits 1990 2004 +14 + Misses 160 158 -2 + Partials 91 90 -1 ``` | [Flag](https://app.codecov.io/gh/man-group/dapr-sidekick-dotnet/pull/29/flags?src=pr&el=flags&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=man-group) | Coverage Δ | | |---|---|---| | [net35](https://app.codecov.io/gh/man-group/dapr-sidekick-dotnet/pull/29/flags?src=pr&el=flag&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=man-group) | `85.67% <100.00%> (+0.27%)` | :arrow_up: | | [net48](https://app.codecov.io/gh/man-group/dapr-sidekick-dotnet/pull/29/flags?src=pr&el=flag&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=man-group) | `86.96% <100.00%> (+0.25%)` | :arrow_up: | | [net5.0](https://app.codecov.io/gh/man-group/dapr-sidekick-dotnet/pull/29/flags?src=pr&el=flag&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=man-group) | `88.36% <100.00%> (+0.20%)` | :arrow_up: | Flags with carried forward coverage won't be shown. [Click here](https://docs.codecov.io/docs/carryforward-flags?utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=man-group#carryforward-flags-in-the-pull-request-comment) to find out more.

:umbrella: View full report in Codecov by Sentry.
:loudspeaker: Have feedback on the report? Share it here.