Skip to main content

proxy

The proxy module provides functions to set and get (immediately and reactively) HTTP proxy configuration. Note that it is not possible to change the state (enabled or disabled) of the proxy settings from the API.

Example

import * as api from '@podman-desktop/api';

export async function activate(extensionContext: api.ExtensionContext): Promise<void> {
const handleProxyConfiguration = (e: boolean | undefined, s: api.ProxySettings | undefined) => {
console.log(e, s);
}

let enabled: boolean | undefined = undefined;
let settings: api.ProxySettings | undefined = undefined;

// Configuration changes
extensionContext.subscriptions.push(
api.proxy.onDidStateChange((e: boolean) => {
enabled = e;
handleProxyConfiguration(enabled, settings);
}),
api.proxy.onDidUpdateProxy((s: api.ProxySettings) => {
settings = s;
handleProxyConfiguration(enabled, settings);
}),
);
// Initial configuration
enabled = api.proxy.isEnabled();
settings = api.proxy.getProxySettings();
handleProxyConfiguration(enabled, settings);
}

Index

Functions