Skip to content

Commit

Permalink
RStudio: added grabbing proxy-related env vars from container context…
Browse files Browse the repository at this point in the history
…, setting them in R globan env file.

Also changed env var search to beginning-of-line regex format for all env vars.

Signed-off-by: shalberd <[email protected]>
  • Loading branch information
shalberd committed Dec 9, 2024
1 parent ecd9e76 commit fbcec28
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 2 deletions.
6 changes: 5 additions & 1 deletion rstudio/c9s-python-3.11/run-rstudio.sh
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,11 @@ do
done
# rstudio terminal cant see environment variables set by the container runtime
# (which breaks kubectl, to fix this we store the KUBERNETES_* env vars in Renviron.site)
env | grep KUBERNETES_ >> /usr/lib64/R/etc/Renviron.site
# Also, we store proxy-related env vars lowercased by key so RStudio projects work with proxy by default
env | grep "^KUBERNETES_" >> /usr/lib64/R/etc/Renviron.site
env | grep "^HTTP_PROXY=" | tr '[:upper:]' '[:lower:]' >> /usr/lib64/R/etc/Renviron.site
env | grep "^HTTPS_PROXY=" | tr '[:upper:]' '[:lower:]' >> /usr/lib64/R/etc/Renviron.site
env | grep "^NO_PROXY=" | tr '[:upper:]' '[:lower:]' >> /usr/lib64/R/etc/Renviron.site

export USER=$(whoami)

Expand Down
6 changes: 5 additions & 1 deletion rstudio/c9s-python-3.9/run-rstudio.sh
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,11 @@ do
done
# rstudio terminal cant see environment variables set by the container runtime
# (which breaks kubectl, to fix this we store the KUBERNETES_* env vars in Renviron.site)
env | grep KUBERNETES_ >> /usr/lib64/R/etc/Renviron.site
# Also, we store proxy-related env vars lowercased by key so RStudio projects work with proxy by default
env | grep "^KUBERNETES_" >> /usr/lib64/R/etc/Renviron.site
env | grep "^HTTP_PROXY=" | tr '[:upper:]' '[:lower:]' >> /usr/lib64/R/etc/Renviron.site
env | grep "^HTTPS_PROXY=" | tr '[:upper:]' '[:lower:]' >> /usr/lib64/R/etc/Renviron.site
env | grep "^NO_PROXY=" | tr '[:upper:]' '[:lower:]' >> /usr/lib64/R/etc/Renviron.site

export USER=$(whoami)

Expand Down

0 comments on commit fbcec28

Please sign in to comment.