Skip to content

Add option to configure cslb options without environment variables  #4

Description

@jenskueper

Summary

Currently, configuring cslb is challenging, especially for applications that rely on it during tests. The primary limitation stems from the use of the cslb_options environment variable during the init phase. This approach provides minimal flexibility for pre-test configuration, as init runs before the test code.

Problem Statement

  1. Environment Variable Dependence: Configuration via the cslb_options environment variable happens during init, limiting the ability to dynamically adjust settings during test execution.

  2. Testing Challenges: Writing tests for applications using cslb becomes cumbersome because:

  • Configuration must be predefined, making test setup less flexible.

  • Changes to cslb behavior during tests are difficult to implement.

  1. Code Maintainability: The current approach makes it harder to isolate and test functionality, reducing maintainability and increasing the risk of brittle tests.

Proposed Solution

Introduce configurable options via a new function, such as cslb.EnableWithOptions, or extend the existing cslb.Enable function to accept a configuration object or parameters. This would allow developers to:

  • Configure cslb programmatically at runtime.
  • Avoid reliance on the cslb_options environment variable.

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

Labels

enhancementNew feature or request

Projects

No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions