Skip to content

Libsreg TrustEnv config #777

Description

@mejroslav

Summary

LibsRegLibraryProvider hardcodes TrustEnv = True when creating the aiohttp.ClientSession for periodic library pulls. This value should be configurable via the [general] config section.

Problem

In asab/library/providers/libsreg.py, the HTTP client used to download library archives always trusts environment variables for proxy/SSL settings:

# TODO: Read this for `[general]` config
self.TrustEnv = True

Used later as:

async with aiohttp.ClientSession(connector=connector, trust_env=self.TrustEnv) as session:
    async with session.get(url, headers=headers) as response:
        ...

When trust_env=True, aiohttp reads proxy settings from environment variables (HTTP_PROXY, HTTPS_PROXY, NO_PROXY, etc.). This is useful in corporate/restricted networks, but it cannot be disabled or overridden without code changes.

Expected behavior

TrustEnv should be read from configuration, following the same pattern as other global settings in [general] (e.g. tick_period, pidfile).

Suggested config:

[general]
trust_env=true
  • Default: true (preserve current behavior)
  • When false: aiohttp ignores proxy-related environment variables

Proposed implementation

  • Add trust_env to [general] defaults in asab/config.py (default: true)

  • Read the value in LibsRegLibraryProvider.init():

    self.TrustEnv = asab.Config.getboolean("general", "trust_env", fallback=True)
  • Document the option in docs/reference/services/library.md (libsreg section)

  • Add to etc/sample.conf (optional, commented)

Metadata

Metadata

Assignees

No one assigned

    Labels

    enhancementNew feature or request

    Fields

    No fields configured for Feature.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions