Package 'proxyconfig'

Title: Tools to Configure Proxy Interactively
Description: Helpers functions and Rstudio Addins to help configure proxy more easily.
Authors: Christophe Dervieux [aut, cre]
Maintainer: Christophe Dervieux <[email protected]>
License: MIT + file LICENSE
Version: 0.0.0.9002
Built: 2026-06-10 16:04:01 UTC
Source: https://github.com/cderv/proxyconfig

Help Index


Verify if a proxy is configured

Description

This checks for any set environment variable relevant to proxy

Usage

is_proxy_activated(verbose = FALSE)

Arguments

verbose

if TRUE will print a summary of configuration. Authentification is redacted for printing

Value

TRUE is a proxy is configured. FALSE otherwise.

Examples

## Not run: 
  is_proxy_activated(verbose = TRUE)

## End(Not run)

Ask interactively for authentification

Description

This will use if available in this order

  • RStudio IDE prompt

  • Console input

Usage

read_password(prompt)

Arguments

prompt

text prompt to user

Value

invisibly the input of the user

Examples

if (interactive()) {
 pwd <- read_password("password")
}

Configure the proxy for internet connection

Description

this will help to set up the proxy configuration using environment variable

  • url of the proxy with port

  • authentification if necessary (username and password)

  • any domain that proxy should ignore

  • activate or not https proxy

You can set a proxy url across sessions by setting option "proxyconfig.proxy".

Usage

set_proxy(proxy = getOption("proxyconfig.proxy", default = NA_character_),
  username = NULL, password = NULL, noproxy = NULL, https = TRUE)

Arguments

proxy

a character giving the proxy url. By default, it will fetch for option proxyconfig.proxy that can be set accross sessions in .Rprofile or Rprofile.site.

username

character. If NULL, user will be prompted

password

character. If NULL, user will be prompted

noproxy

character vector of domain that proxy should ignore

https

logical. If TRUE HTTPS_PROXY will be used

Value

TRUE invisibly if no error. Side effects are the environment variables for proxy being set for the session. You can check them with base::Sys.getenv()

FALSE invisibly with a warning if a proxy configuration was already set. You need to unset the configuration with unset_proxy() before setting a new one.

Proxy Environment Variable

The proxy is set using environment variables

  • HTTP_PROXY

  • HTTPS_PROXY

  • NO_PROXY The lower case version are also set because some utilities do not understand upper case environment variable.

This configuration is used by curl for internet connection and other method. See Setting Proxies in utils::download.file()

Examples

## Not run: 
 set_proxy(proxy = "http://10.132.23.444:3232",
           username = "",
           password = "",
           noproxy = ".mycompany.com",
           https = TRUE)
is_proxy_activated(verbose = TRUE)

## End(Not run)

Unset proxy configuration for the session

Description

This fonction is a helper to unset all configuration of proxy for the current session.

Usage

unset_proxy(verbose = FALSE)

Arguments

verbose

default is FALSE.

Value

FALSE is no proxy configuration was set before. TRUE if configuration is unset with success.

Examples

## Not run: 
 set_proxy(proxy = "http://10.132.23.444:3232",
           username = "",
           password = "",
           noproxy = ".mycompany.com",
           https = TRUE)
 is_proxy_activated(verbose = TRUE)
 unset_proxy(verbose = TRUE)
 is_proxy_activated(verbose = TRUE)
 
## End(Not run)