Server Proxy Config

class oscopilot.utils.server_config.ConfigManager[source]

Bases: object

A singleton class responsible for managing configuration settings across the application.

This class implements the singleton design pattern to ensure that only one instance of the ConfigManager exists at any time. It provides methods to set, apply, and clear proxy settings for HTTP and HTTPS traffic.

_instance

A private class-level attribute that holds the singleton instance.

Type:

ConfigManager

http_proxy

The HTTP proxy URL.

Type:

str

https_proxy

The HTTPS proxy URL.

Type:

str

apply_proxies()[source]

Applies the configured proxy settings by setting them in the environments variables.

The method sets the ‘http_proxy’ and ‘https_proxy’ environments variables based on the configured proxy URLs. If no proxies are configured, the environments variables are not modified.

clear_proxies()[source]

Clears the proxy settings from the environments variables.

This method removes the ‘http_proxy’ and ‘https_proxy’ entries from the environments variables, effectively clearing any proxy settings that were previously applied.

set_proxies(http, https)[source]

Sets the HTTP and HTTPS proxy URLs.

Parameters:
  • http (str) – The HTTP proxy URL.

  • https (str) – The HTTPS proxy URL.