-
Notifications
You must be signed in to change notification settings - Fork 103
Set individual formatters with key-value based environment variables #769
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
…verts the input to an override to be applied via Environment Variable.
…now uses key-value pairs, such as --logger "formatter;name=message;outputFilePath=foo.ndjson". The infrastructure is now in place to set multiple loggers on the command line, but that is not yet working.
…derive from a base class.
Added description of how to configure the formatters using the --logger command line.
Co-authored-by: obligaron <[email protected]>
…ovider for consistency
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Pull Request Overview
This PR introduces formatter-specific environment variable configuration support for Reqnroll formatters. The changes allow users to configure individual formatters using simple key-value pairs in environment variables like REQNROLL_FORMATTERS_HTML, which take precedence over the existing JSON-based REQNROLL_FORMATTERS variable.
- Adds a new
KeyValueEnvironmentConfigurationResolverto parse formatter-specific environment variables - Refactors the existing environment configuration resolver to focus specifically on JSON format
- Updates the configuration provider to handle both JSON and key-value environment variable overrides with proper precedence
Reviewed Changes
Copilot reviewed 20 out of 20 changed files in this pull request and generated 2 comments.
Show a summary per file
| File | Description |
|---|---|
docs/reporting/reqnroll-formatters.md |
Updates documentation to mention environment variable configuration option |
docs/installation/formatter-configuration.md |
Adds comprehensive documentation for formatter-specific environment variables with examples |
Tests/Reqnroll.RuntimeTests/Formatters/Configuration/KeyValueEnvironmentConfigurationResolverTests.cs |
New test file with comprehensive test coverage for the key-value environment configuration resolver |
Tests/Reqnroll.RuntimeTests/Formatters/Configuration/JsonEnvironmentConfigurationResolverTests.cs |
Renames and updates tests for the JSON-specific environment configuration resolver |
Tests/Reqnroll.RuntimeTests/Formatters/Configuration/CucumberConfigurationTests.cs |
Updates test to work with refactored configuration provider dependencies |
Tests/Reqnroll.RuntimeTests/EnvironmentWrapperStub.cs |
Adds implementation for new GetEnvironmentVariables method |
Tests/Reqnroll.Formatters.Tests/MessagesCompatibilityTestBase.cs |
Updates test setup to use refactored configuration provider |
Reqnroll/Infrastructure/DefaultDependencyProvider.cs |
Updates DI container registrations for the refactored configuration resolvers |
Reqnroll/Formatters/Configuration/KeyValueEnvironmentConfigurationResolver.cs |
New resolver implementation for parsing key-value environment variables |
Reqnroll/Formatters/Configuration/JsonEnvironmentConfigurationResolver.cs |
Refactored from generic environment resolver to focus on JSON format |
Reqnroll/Formatters/Configuration/IKeyValueEnvironmentConfigurationResolver.cs |
New interface for key-value environment configuration resolver |
Reqnroll/Formatters/Configuration/IJsonEnvironmentConfigurationResolver.cs |
New interface for JSON environment configuration resolver |
Reqnroll/Formatters/Configuration/IFormattersConfigurationResolverBase.cs |
Removes deprecated interfaces |
Reqnroll/Formatters/Configuration/IFileBasedConfigurationResolver.cs |
New interface for file-based configuration resolver |
Reqnroll/Formatters/Configuration/FormattersConfigurationResolverBase.cs |
Minor formatting change |
Reqnroll/Formatters/Configuration/FormattersConfigurationProvider.cs |
Updates to use new resolver interfaces and handle null values for disabled formatters |
Reqnroll/Formatters/Configuration/FormattersConfigurationConstants.cs |
Adds constant for formatter environment variable prefix |
Reqnroll/Formatters/Configuration/FileBasedConfigurationResolver.cs |
Updates interface implementation |
Reqnroll/EnvironmentAccess/IEnvironmentWrapper.cs |
Adds method signature for getting environment variables by prefix |
Reqnroll/EnvironmentAccess/EnvironmentWrapper.cs |
Implements method to retrieve environment variables by prefix |
Tip: Customize your code reviews with copilot-instructions.md. Create the file or learn how to get started.
Reqnroll/Formatters/Configuration/KeyValueEnvironmentConfigurationResolver.cs
Outdated
Show resolved
Hide resolved
Co-authored-by: Copilot <[email protected]>
…tionResolver.cs Co-authored-by: Copilot <[email protected]>
clrudolphi
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looks good
🤔 What's changed?
Taking out generic stuff from #697 and applied for standard environment variable handling, i.e. now the formatters can be configured with specific environment variables, like
REQNROLL_FORMATTERS_HTML, with simple key-value settings:These environment variables can also be used to enable a formatter with default settings:
$env:REQNROLL_FORMATTERS_HTML = 'true'or disable them (if they have been configured in config file:$env:REQNROLL_FORMATTERS_HTML = 'false'.These environment variables have higher precedence than the JSON based
REQNROLL_FORMATTERS, so override them.Also made sure that the formatter names and the setting names are treated case insensitive, e.g.
$env:REQNROLL_FORMATTERS_HTML = 'OUTputFilePath=test.html'sets theoutputFilePathsetting of thehtmlformatter.⚡️ What's your motivation?
Provide a simple way of configuring formatters from shell.
🏷️ What kind of change is this?
♻️ Anything particular you want feedback on?
📋 Checklist:
This text was originally taken from the template of the Cucumber project, then edited by hand. You can modify the template here.