Setting Environment Variables in Posit Workbench

Follow

 

The following methods can be used if you need to set an environment variable that will populate across your R session, VS code, Jupyter Notebook & JupyterLab Sessions.

 

Method 1:

You may specify environment variables to set when creating launcher sessions.

To specify environment overrides, modify the /etc/rstudio/launcher-env file to consist of multiple environment entries separated by a blank line. see details here.

An example /etc/rstudio/launcher-env file is shown below.

/etc/rstudio/launcher-env
https_proxy=https://proxyURL
http_proxy=http://proxyURL

 

Method 2: 

In the example below, we'll configure a proxy environment variable using a Linux feature to apply it across all sessions. 


1. Create a script in the  /etc/profile.d  directory, for example:

 

touch /etc/profile.d/environment.sh
chmod 755 /etc/profile.d/environment.sh

 

2. Modify the environment.sh to contain the environment variables you wish to set.  Example 
 /etc/profile.d/environment.sh Contents:

export https_proxy=https://proxyURL
export http_proxy=http://proxyURL

 

3. Once this is set, restart the services:

rstudio-launcher restart
rstudio-server restart

 

If the issue persists, feel free to open a support ticket here: https://support.posit.co/hc/en-us/requests/new

Comments