Skip to content
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

Allow configuration of internal parameters #784

Closed
Uxio0 opened this issue Feb 19, 2024 · 0 comments · Fixed by #947
Closed

Allow configuration of internal parameters #784

Uxio0 opened this issue Feb 19, 2024 · 0 comments · Fixed by #947
Assignees
Labels
enhancement New feature or request

Comments

@Uxio0
Copy link
Member

Uxio0 commented Feb 19, 2024

For example, currently in multiple places we have HTTP connection pool configurations that could be refactored to get the configuration from environment variables

For example, current code from EthereumClient:

class EthereumClient:
    def __init__(
        self,
        ethereum_node_url: URI = URI("http://localhost:8545"),
        provider_timeout: int = 15,
        slow_provider_timeout: int = 60,
        retry_count: int = 1,
        use_caching_middleware: bool = True,
        batch_request_max_size: int = 500,
    ):

to

class EthereumClient:
    def __init__(
        self,
        ethereum_node_url: URI = URI("http://localhost:8545"),
        provider_timeout: int = int(os.environ.get("ETHEREUM_NODE_TIMEOUT", 15)),
        slow_provider_timeout: int = int(os.environ.get("ETHEREUM_NODE_SLOW_TIMEOUT", 60)),
        retry_count: int = int(os.environ.get("ETHEREUM_NODE_RETRY_COUNT", 1)),
        use_caching_middleware: bool = True,
        batch_request_max_size: int = int(os.environ.get("ETHEREUM_NODE_BATCH_REQUEST_SIZE", 500)),
    ):

or define a configuration class like

class EthereumClientConfiguration:

To refactor the environment reading and configuration

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants